blob: 2b567acaa04d2b9d20ad79afd3817f030e337dd3 [file] [log] [blame]
samuel8d6b0a92015-07-11 13:22:57 +08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
samuel8d6b0a92015-07-11 13:22:57 +08003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.net.behaviour;
18
19import com.google.common.annotations.Beta;
20
21import java.util.Objects;
22
23/**
24 * Represents for a unique tunnel name. TunnelId is generated by ONOS while
25 * TunnelName is given by producer. The consumer can borrow tunnels with
26 * TunnelId or TunnelName.
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070027 *
28 * @deprecated version 1.7.0 - Hummingbird
samuel8d6b0a92015-07-11 13:22:57 +080029 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070030@Deprecated
samuel8d6b0a92015-07-11 13:22:57 +080031@Beta
32public final class TunnelName {
33 private final String str;
34
35 // Default constructor for serialization
36 private TunnelName(String tunnelName) {
37 this.str = tunnelName;
38 }
39
40
41 /**
42 * Creates a tunnel name using the supplied URI string.
43 *
44 * @param tunnelName tunnel name string
45 * @return tunnel name object
46 */
47 public static TunnelName tunnelName(String tunnelName) {
48 return new TunnelName(tunnelName);
49 }
50
51 /**
52 * The string of tunnel name.
53 *
54 * @return the string of tunnel name
55 */
56 public String value() {
57 return str;
58 }
59
60 @Override
61 public int hashCode() {
62 return Objects.hash(str);
63 }
64
65 @Override
66 public boolean equals(Object obj) {
67 if (this == obj) {
68 return true;
69 }
70 if (obj instanceof TunnelName) {
71 final TunnelName that = (TunnelName) obj;
72 return this.getClass() == that.getClass()
73 && Objects.equals(this.str, that.str);
74 }
75 return false;
76 }
77
78 @Override
79 public String toString() {
80 return str;
81 }
82}