blob: dde3da3665d798fbd69124a960c2de3262be0201 [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.cfm.identifier;
17
18import org.onlab.util.Identifier;
19
20/**
21 * Representation of a Mep Id.
22 */
23public final class MepId extends Identifier<Short> {
24
25 private MepId(short id) {
26 super(id);
27 }
28
29 public static MepId valueOf(short id) {
30 if (id < 1 || id > 8191) {
31 throw new IllegalArgumentException(
32 "Invalid value for Mep Id - must be between 1-8191 inclusive. "
33 + "Rejecting " + id);
34 }
35 return new MepId(id);
36 }
37
38 public short value() {
39 return this.identifier;
40 }
41
42 @Override
43 public String toString() {
44 return String.valueOf(identifier);
45 }
46}