Thomas Vachuska | 58de416 | 2015-09-10 16:15:33 -0700 | [diff] [blame^] | 1 | /*
|
| 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 | */
|
CNlucius | 5b2fff1 | 2015-08-20 14:13:46 +0800 | [diff] [blame] | 16 | package org.onosproject.vtnrsc;
|
| 17 |
|
| 18 | import static com.google.common.base.Preconditions.checkNotNull;
|
| 19 |
|
| 20 | import java.util.Objects;
|
| 21 |
|
| 22 | public final class BindingHostId {
|
| 23 | private final String bindingHostId;
|
| 24 |
|
| 25 | // Public construction is prohibited
|
| 26 | private BindingHostId(String bindingHostId) {
|
| 27 | checkNotNull(bindingHostId, "BindingHosttId cannot be null");
|
| 28 | this.bindingHostId = bindingHostId;
|
| 29 | }
|
| 30 |
|
| 31 | /**
|
| 32 | * Creates a BindingHostId identifier.
|
| 33 | *
|
| 34 | * @param bindingHostId the bindingHostId identifier
|
| 35 | * @return the bindingHostId identifier
|
| 36 | */
|
| 37 | public static BindingHostId bindingHostId(String bindingHostId) {
|
| 38 | return new BindingHostId(bindingHostId);
|
| 39 | }
|
| 40 |
|
| 41 | /**
|
| 42 | * Returns the bindingHostId identifier.
|
| 43 | *
|
| 44 | * @return the bindingHostId identifier
|
| 45 | */
|
| 46 | public String bindingHostId() {
|
| 47 | return bindingHostId;
|
| 48 | }
|
| 49 |
|
| 50 | @Override
|
| 51 | public int hashCode() {
|
| 52 | return Objects.hash(bindingHostId);
|
| 53 | }
|
| 54 |
|
| 55 | @Override
|
| 56 | public boolean equals(Object obj) {
|
| 57 | if (this == obj) {
|
| 58 | return true;
|
| 59 | }
|
| 60 | if (obj instanceof BindingHostId) {
|
| 61 | final BindingHostId that = (BindingHostId) obj;
|
| 62 | return this.getClass() == that.getClass()
|
| 63 | && Objects.equals(this.bindingHostId, that.bindingHostId);
|
| 64 | }
|
| 65 | return false;
|
| 66 | }
|
| 67 |
|
| 68 | @Override
|
| 69 | public String toString() {
|
| 70 | return bindingHostId;
|
| 71 | }
|
| 72 | }
|