blob: fb7b594a6f27c48753f7b6d45d8bc6a026f29042 [file] [log] [blame]
Yuta HIGUCHIeb28a7c2017-01-13 18:59:27 -08001/*
2 * Copyright 2017-present 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.net;
17
18import static com.google.common.base.Preconditions.checkNotNull;
19
20/**
21 * MarkerResource to add hints about installable Intent.
22 */
23public 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}