Phaneendra Manda | ac63650 | 2015-10-26 22:28:09 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Phaneendra Manda | ac63650 | 2015-10-26 22:28:09 +0530 | [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.vtnrsc; |
| 17 | |
Jian Li | d79fb94 | 2016-02-29 13:42:23 -0800 | [diff] [blame] | 18 | import org.onlab.util.Identifier; |
Phaneendra Manda | ac63650 | 2015-10-26 22:28:09 +0530 | [diff] [blame] | 19 | |
| 20 | import java.util.UUID; |
Jian Li | d79fb94 | 2016-02-29 13:42:23 -0800 | [diff] [blame] | 21 | |
| 22 | import static com.google.common.base.Preconditions.checkNotNull; |
Phaneendra Manda | ac63650 | 2015-10-26 22:28:09 +0530 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * Representation of a Port Chain ID. |
| 26 | */ |
Jian Li | d79fb94 | 2016-02-29 13:42:23 -0800 | [diff] [blame] | 27 | public final class PortChainId extends Identifier<UUID> { |
Phaneendra Manda | ac63650 | 2015-10-26 22:28:09 +0530 | [diff] [blame] | 28 | /** |
| 29 | * Private constructor for port chain id. |
| 30 | * |
| 31 | * @param id UUID id of port chain |
| 32 | */ |
| 33 | private PortChainId(UUID id) { |
Jian Li | d79fb94 | 2016-02-29 13:42:23 -0800 | [diff] [blame] | 34 | super(checkNotNull(id, "Port chain id can not be null")); |
Phaneendra Manda | ac63650 | 2015-10-26 22:28:09 +0530 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | /** |
Mahesh Poojary Huawei | a9feb6d | 2015-11-05 13:24:16 +0530 | [diff] [blame] | 38 | * Returns newly created port chain id object. |
Phaneendra Manda | ac63650 | 2015-10-26 22:28:09 +0530 | [diff] [blame] | 39 | * |
| 40 | * @param id UUID of port chain |
| 41 | * @return object of port chain id |
| 42 | */ |
Mahesh Poojary Huawei | a9feb6d | 2015-11-05 13:24:16 +0530 | [diff] [blame] | 43 | public static PortChainId of(UUID id) { |
Phaneendra Manda | ac63650 | 2015-10-26 22:28:09 +0530 | [diff] [blame] | 44 | return new PortChainId(id); |
| 45 | } |
| 46 | |
| 47 | /** |
Mahesh Poojary Huawei | a9feb6d | 2015-11-05 13:24:16 +0530 | [diff] [blame] | 48 | * Returns newly created port chain id object. |
Phaneendra Manda | ac63650 | 2015-10-26 22:28:09 +0530 | [diff] [blame] | 49 | * |
| 50 | * @param id port chain id in string |
| 51 | * @return object of port chain id |
| 52 | */ |
Mahesh Poojary Huawei | a9feb6d | 2015-11-05 13:24:16 +0530 | [diff] [blame] | 53 | public static PortChainId of(String id) { |
Phaneendra Manda | ac63650 | 2015-10-26 22:28:09 +0530 | [diff] [blame] | 54 | 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 Li | d79fb94 | 2016-02-29 13:42:23 -0800 | [diff] [blame] | 63 | return identifier; |
Phaneendra Manda | ac63650 | 2015-10-26 22:28:09 +0530 | [diff] [blame] | 64 | } |
| 65 | } |