Yuta HIGUCHI | eb28a7c | 2017-01-13 18:59:27 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
Yuta HIGUCHI | eb28a7c | 2017-01-13 18:59:27 -0800 | [diff] [blame] | 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 | package org.onosproject.net; |
| 17 | |
| 18 | import static com.google.common.base.Preconditions.checkNotNull; |
| 19 | |
| 20 | /** |
| 21 | * MarkerResource to add hints about installable Intent. |
| 22 | */ |
| 23 | public final class MarkerResource implements NetworkResource { |
| 24 | private final String mark; |
| 25 | |
| 26 | private MarkerResource(String mark) { |
| 27 | this.mark = checkNotNull(mark); |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Creates an instance of MarkerResource. |
| 32 | * |
| 33 | * @param mark marker String |
| 34 | * @return MarkerResource |
| 35 | */ |
| 36 | public static MarkerResource marker(String mark) { |
| 37 | return new MarkerResource(mark); |
| 38 | } |
| 39 | |
| 40 | @Override |
| 41 | public int hashCode() { |
| 42 | return mark.hashCode(); |
| 43 | } |
| 44 | |
| 45 | @Override |
| 46 | public boolean equals(Object obj) { |
| 47 | if (obj instanceof MarkerResource) { |
| 48 | return mark.equals(((MarkerResource) obj).mark); |
| 49 | } |
| 50 | return false; |
| 51 | } |
| 52 | |
| 53 | @Override |
| 54 | public String toString() { |
| 55 | return mark; |
| 56 | } |
| 57 | |
| 58 | |
| 59 | private MarkerResource() { |
| 60 | this.mark = ""; |
| 61 | } |
| 62 | } |