Mohammad Shahid | aa7c123 | 2017-08-09 11:13:15 +0530 | [diff] [blame] | 1 | /* |
| 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 Milkey | a95193c | 2017-08-10 15:35:36 -0700 | [diff] [blame] | 17 | package org.onosproject.evpnrouteservice; |
Mohammad Shahid | aa7c123 | 2017-08-09 11:13:15 +0530 | [diff] [blame] | 18 | |
| 19 | import java.util.Objects; |
| 20 | |
| 21 | import static com.google.common.base.MoreObjects.toStringHelper; |
| 22 | |
| 23 | /** |
| 24 | * Represents the EvpnInstanceName. |
| 25 | */ |
| 26 | public 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 | } |