blob: f1ea22ac16cf30c38fe80fe97bc90405f7871f67 [file] [log] [blame]
Mohammad Shahidaa7c1232017-08-09 11:13:15 +05301/*
2 * Copyright 2017-present Open Networking Foundation
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 */
16
Ray Milkeya95193c2017-08-10 15:35:36 -070017package org.onosproject.evpnrouteservice;
Mohammad Shahidaa7c1232017-08-09 11:13:15 +053018
19import java.util.Objects;
20
21import static com.google.common.base.MoreObjects.toStringHelper;
22
23/**
24 * Represents the EvpnInstanceName.
25 */
26public final class EvpnInstanceName {
27 private final String evpnName;
28
29 /**
30 * Constructor to initialize the parameters.
31 *
32 * @param evpnName EvpnInstanceName
33 */
34 private EvpnInstanceName(String evpnName) {
35 this.evpnName = evpnName;
36 }
37
38 /**
39 * Creates instance of EvpnInstanceName.
40 *
41 * @param evpnName evpnName
42 * @return evpnInstanceName
43 */
44 public static EvpnInstanceName evpnName(String evpnName) {
45 return new EvpnInstanceName(evpnName);
46 }
47
48 /**
49 * Get vpn instance name.
50 *
51 * @return evpnName
52 */
53 public String getEvpnName() {
54 return evpnName;
55 }
56
57 @Override
58 public int hashCode() {
59 return Objects.hash(evpnName);
60 }
61
62 @Override
63 public boolean equals(Object obj) {
64 if (this == obj) {
65 return true;
66 }
67
68 if (obj instanceof EvpnInstanceName) {
69 EvpnInstanceName other = (EvpnInstanceName) obj;
70 return Objects.equals(this.evpnName, other.evpnName);
71 }
72 return false;
73 }
74
75 @Override
76 public String toString() {
77 return toStringHelper(this).add("evpnName", evpnName).toString();
78 }
79}