blob: bf724fa47fb336399b794ee624c5c29b4ba66455 [file] [log] [blame]
YuanyouZhangf26445a2015-07-22 17:13:18 +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;
20import java.util.Objects;
21
22/**
BitOhenry9b161fb2015-10-28 14:59:48 +080023 * The class representing an ifaceid.
24 * This class is immutable.
YuanyouZhangf26445a2015-07-22 17:13:18 +080025 */
26public class OvsdbIfaceId {
27 private final String value;
28
29 /**
BitOhenry9b161fb2015-10-28 14:59:48 +080030 * Constructor from a String.
YuanyouZhangf26445a2015-07-22 17:13:18 +080031 *
32 * @param value the ifaceid to use
33 */
34 public OvsdbIfaceId(String value) {
35 checkNotNull(value, "value is not null");
36 this.value = value;
37 }
38
39 /**
BitOhenry9b161fb2015-10-28 14:59:48 +080040 * Gets the value of ifaceid.
YuanyouZhangf26445a2015-07-22 17:13:18 +080041 *
BitOhenry9b161fb2015-10-28 14:59:48 +080042 * @return the value of ifaceid
YuanyouZhangf26445a2015-07-22 17:13:18 +080043 */
44 public String value() {
45 return value;
46 }
47
48 @Override
49 public int hashCode() {
HIGUCHI Yutaca9cc8e2015-10-29 23:26:51 -070050 return value.hashCode();
YuanyouZhangf26445a2015-07-22 17:13:18 +080051 }
52
53 @Override
54 public boolean equals(Object obj) {
55 if (this == obj) {
56 return true;
57 }
58 if (obj instanceof OvsdbIfaceId) {
59 final OvsdbIfaceId otherIfaceId = (OvsdbIfaceId) obj;
60 return Objects.equals(this.value, otherIfaceId.value);
61 }
62 return false;
63 }
64
65 @Override
66 public String toString() {
67 return toStringHelper(this).add("value", value).toString();
68 }
69}