Bharat saraswal | b074814 | 2015-10-26 12:22:16 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Bharat saraswal | b074814 | 2015-10-26 12:22:16 +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; |
Bharat saraswal | b074814 | 2015-10-26 12:22:16 +0530 | [diff] [blame] | 19 | |
Mahesh Poojary S | 2b03bf6 | 2015-10-29 11:40:46 +0530 | [diff] [blame] | 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; |
Mahesh Poojary S | 2b03bf6 | 2015-10-29 11:40:46 +0530 | [diff] [blame] | 23 | |
Bharat saraswal | b074814 | 2015-10-26 12:22:16 +0530 | [diff] [blame] | 24 | /** |
| 25 | * Flow classification identifier. |
| 26 | */ |
Jian Li | d79fb94 | 2016-02-29 13:42:23 -0800 | [diff] [blame] | 27 | public final class FlowClassifierId extends Identifier<UUID> { |
Bharat saraswal | b074814 | 2015-10-26 12:22:16 +0530 | [diff] [blame] | 28 | /** |
| 29 | * Constructor to create flow classifier id. |
| 30 | * |
| 31 | * @param flowClassifierId flow classifier id. |
| 32 | */ |
| 33 | private FlowClassifierId(final UUID flowClassifierId) { |
Jian Li | d79fb94 | 2016-02-29 13:42:23 -0800 | [diff] [blame] | 34 | super(checkNotNull(flowClassifierId, "Flow classifier id can not be null")); |
Bharat saraswal | b074814 | 2015-10-26 12:22:16 +0530 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Returns new flow classifier id. |
| 39 | * |
| 40 | * @param flowClassifierId flow classifier id |
| 41 | * @return new flow classifier id |
| 42 | */ |
Mahesh Poojary Huawei | 321cc50 | 2015-11-03 13:23:32 +0530 | [diff] [blame] | 43 | public static FlowClassifierId of(final UUID flowClassifierId) { |
Bharat saraswal | b074814 | 2015-10-26 12:22:16 +0530 | [diff] [blame] | 44 | return new FlowClassifierId(flowClassifierId); |
| 45 | } |
| 46 | |
Bharat saraswal | bf78f4f | 2015-10-28 19:24:56 +0530 | [diff] [blame] | 47 | /** |
| 48 | * Returns new flow classifier id. |
| 49 | * |
| 50 | * @param flowClassifierId flow classifier id |
| 51 | * @return new flow classifier id |
| 52 | */ |
Mahesh Poojary Huawei | 321cc50 | 2015-11-03 13:23:32 +0530 | [diff] [blame] | 53 | public static FlowClassifierId of(final String flowClassifierId) { |
Bharat saraswal | bf78f4f | 2015-10-28 19:24:56 +0530 | [diff] [blame] | 54 | return new FlowClassifierId(UUID.fromString(flowClassifierId)); |
| 55 | } |
| 56 | |
Mahesh Poojary S | 2b03bf6 | 2015-10-29 11:40:46 +0530 | [diff] [blame] | 57 | /** |
| 58 | * Returns the value of flow classifier id. |
| 59 | * |
| 60 | * @return flow classifier id. |
| 61 | */ |
| 62 | public UUID value() { |
Jian Li | d79fb94 | 2016-02-29 13:42:23 -0800 | [diff] [blame] | 63 | return identifier; |
Bharat saraswal | b074814 | 2015-10-26 12:22:16 +0530 | [diff] [blame] | 64 | } |
| 65 | } |