blob: 34c2afa66cbb1cc8b099d2fc88c64cbaf89afdf5 [file] [log] [blame]
Phaneendra Mandaac636502015-10-26 22:28:09 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Phaneendra Mandaac636502015-10-26 22:28:09 +05303 *
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.vtnrsc;
17
Jian Lid79fb942016-02-29 13:42:23 -080018import org.onlab.util.Identifier;
Phaneendra Mandaac636502015-10-26 22:28:09 +053019
20import java.util.UUID;
Jian Lid79fb942016-02-29 13:42:23 -080021
22import static com.google.common.base.Preconditions.checkNotNull;
Phaneendra Mandaac636502015-10-26 22:28:09 +053023
24/**
25 * Representation of a Port Chain ID.
26 */
Jian Lid79fb942016-02-29 13:42:23 -080027public final class PortChainId extends Identifier<UUID> {
Phaneendra Mandaac636502015-10-26 22:28:09 +053028 /**
29 * Private constructor for port chain id.
30 *
31 * @param id UUID id of port chain
32 */
33 private PortChainId(UUID id) {
Jian Lid79fb942016-02-29 13:42:23 -080034 super(checkNotNull(id, "Port chain id can not be null"));
Phaneendra Mandaac636502015-10-26 22:28:09 +053035 }
36
37 /**
Mahesh Poojary Huaweia9feb6d2015-11-05 13:24:16 +053038 * Returns newly created port chain id object.
Phaneendra Mandaac636502015-10-26 22:28:09 +053039 *
40 * @param id UUID of port chain
41 * @return object of port chain id
42 */
Mahesh Poojary Huaweia9feb6d2015-11-05 13:24:16 +053043 public static PortChainId of(UUID id) {
Phaneendra Mandaac636502015-10-26 22:28:09 +053044 return new PortChainId(id);
45 }
46
47 /**
Mahesh Poojary Huaweia9feb6d2015-11-05 13:24:16 +053048 * Returns newly created port chain id object.
Phaneendra Mandaac636502015-10-26 22:28:09 +053049 *
50 * @param id port chain id in string
51 * @return object of port chain id
52 */
Mahesh Poojary Huaweia9feb6d2015-11-05 13:24:16 +053053 public static PortChainId of(String id) {
Phaneendra Mandaac636502015-10-26 22:28:09 +053054 return new PortChainId(UUID.fromString(id));
55 }
56
57 /**
58 * Returns the value of port chain id.
59 *
60 * @return port chain id
61 */
62 public UUID value() {
Jian Lid79fb942016-02-29 13:42:23 -080063 return identifier;
Phaneendra Mandaac636502015-10-26 22:28:09 +053064 }
65}