blob: a4434d99f88ae20570a575047c1b17238bf9ba42 [file] [log] [blame]
Sean Condon0e89bda2017-03-21 14:23:19 +00001/*
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 */
16package org.onosproject.incubator.net.l2monitoring.soam;
17
18import org.onlab.util.Identifier;
19
20/**
21 * Identifier for SOAM objects.
22 */
23public class SoamId extends Identifier<Integer> {
24 protected SoamId(int id) {
25 super(id);
26 }
27
28 /**
29 * Creates a dm ID from a int value.
30 *
31 * @param id int value
32 * @return dm ID
33 */
34 public static SoamId valueOf(int id) {
35 if (id < 0) {
36 throw new IllegalArgumentException("SOAM Value must be unsigned."
37 + "Rejecting: " + id);
38 }
39 return new SoamId(id);
40 }
41
42 /**
43 * Gets the dm ID value.
44 *
45 * @return dm ID value as int
46 */
47 public int value() {
48 return this.identifier;
49 }
50
51 @Override
52 public String toString() {
53 return String.valueOf(identifier);
54 }
55}