blob: 490d640b8d38b01502c6a3e2a401dbacee7bab0d [file] [log] [blame]
CNlucius74fd4942015-07-20 14:28:04 +08001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
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 */
16package org.onosproject.ovsdb.controller;
17
18import static com.google.common.base.MoreObjects.toStringHelper;
19import static com.google.common.base.Preconditions.checkNotNull;
20
21import java.util.Objects;
22
23/**
BitOhenryeea66a92015-11-03 20:52:46 +080024 * The class representing a tunnel name.
25 * This class is immutable.
CNlucius74fd4942015-07-20 14:28:04 +080026 */
27public final class OvsdbTunnelName {
28 private final String value;
29
30 /**
BitOhenryeea66a92015-11-03 20:52:46 +080031 * Constructor from a String.
CNlucius74fd4942015-07-20 14:28:04 +080032 *
33 * @param value the tunnel name to use
34 */
35 public OvsdbTunnelName(String value) {
36 checkNotNull(value, "value is not null");
37 this.value = value;
38 }
39
40 /**
BitOhenryeea66a92015-11-03 20:52:46 +080041 * Gets the value of tunnel name.
CNlucius74fd4942015-07-20 14:28:04 +080042 *
BitOhenryeea66a92015-11-03 20:52:46 +080043 * @return the value of tunnel name
CNlucius74fd4942015-07-20 14:28:04 +080044 */
45 public String value() {
46 return value;
47 }
48
49 @Override
50 public int hashCode() {
HIGUCHI Yutaca9cc8e2015-10-29 23:26:51 -070051 return value.hashCode();
CNlucius74fd4942015-07-20 14:28:04 +080052 }
53
54 @Override
55 public boolean equals(Object obj) {
56 if (this == obj) {
57 return true;
58 }
59 if (obj instanceof OvsdbTunnelName) {
60 final OvsdbTunnelName otherOvsdbTunnelName = (OvsdbTunnelName) obj;
61 return Objects.equals(this.value, otherOvsdbTunnelName.value);
62 }
63 return false;
64 }
65
66 @Override
67 public String toString() {
68 return toStringHelper(this).add("value", value).toString();
69 }
70}