blob: 693d2eb6902ebc10962ba6fd82f8c94c19754ee0 [file] [log] [blame]
Bharat saraswalb0748142015-10-26 12:22:16 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Bharat saraswalb0748142015-10-26 12:22:16 +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;
Bharat saraswalb0748142015-10-26 12:22:16 +053019
Mahesh Poojary S2b03bf62015-10-29 11:40:46 +053020import java.util.UUID;
Jian Lid79fb942016-02-29 13:42:23 -080021
22import static com.google.common.base.Preconditions.checkNotNull;
Mahesh Poojary S2b03bf62015-10-29 11:40:46 +053023
Bharat saraswalb0748142015-10-26 12:22:16 +053024/**
25 * Flow classification identifier.
26 */
Jian Lid79fb942016-02-29 13:42:23 -080027public final class FlowClassifierId extends Identifier<UUID> {
Bharat saraswalb0748142015-10-26 12:22:16 +053028 /**
29 * Constructor to create flow classifier id.
30 *
31 * @param flowClassifierId flow classifier id.
32 */
33 private FlowClassifierId(final UUID flowClassifierId) {
Jian Lid79fb942016-02-29 13:42:23 -080034 super(checkNotNull(flowClassifierId, "Flow classifier id can not be null"));
Bharat saraswalb0748142015-10-26 12:22:16 +053035 }
36
37 /**
38 * Returns new flow classifier id.
39 *
40 * @param flowClassifierId flow classifier id
41 * @return new flow classifier id
42 */
Mahesh Poojary Huawei321cc502015-11-03 13:23:32 +053043 public static FlowClassifierId of(final UUID flowClassifierId) {
Bharat saraswalb0748142015-10-26 12:22:16 +053044 return new FlowClassifierId(flowClassifierId);
45 }
46
Bharat saraswalbf78f4f2015-10-28 19:24:56 +053047 /**
48 * Returns new flow classifier id.
49 *
50 * @param flowClassifierId flow classifier id
51 * @return new flow classifier id
52 */
Mahesh Poojary Huawei321cc502015-11-03 13:23:32 +053053 public static FlowClassifierId of(final String flowClassifierId) {
Bharat saraswalbf78f4f2015-10-28 19:24:56 +053054 return new FlowClassifierId(UUID.fromString(flowClassifierId));
55 }
56
Mahesh Poojary S2b03bf62015-10-29 11:40:46 +053057 /**
58 * Returns the value of flow classifier id.
59 *
60 * @return flow classifier id.
61 */
62 public UUID value() {
Jian Lid79fb942016-02-29 13:42:23 -080063 return identifier;
Bharat saraswalb0748142015-10-26 12:22:16 +053064 }
65}