blob: 012adb7cd21e5e5cc686c73513d92c3ac6bba595 [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 Open Networking Laboratory
Thomas Vachuska83e090e2014-10-22 14:25:35 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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
Thomas Vachuska83e090e2014-10-22 14:25:35 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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.
Thomas Vachuska83e090e2014-10-22 14:25:35 -070015 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.flow;
Ayaka Koshibe414196d2014-09-17 13:46:43 -070017
Jian Lib6d998e2016-02-29 11:41:18 -080018import org.onlab.util.Identifier;
alshabiba7f7ca82014-09-22 11:41:23 -070019
Ayaka Koshibe414196d2014-09-17 13:46:43 -070020/**
21 * Representation of a Flow ID.
22 */
Jian Lib6d998e2016-02-29 11:41:18 -080023public final class FlowId extends Identifier<Long> {
Ayaka Koshibe414196d2014-09-17 13:46:43 -070024
alshabiba7f7ca82014-09-22 11:41:23 -070025 private FlowId(long id) {
Jian Lib6d998e2016-02-29 11:41:18 -080026 super(id);
Ayaka Koshibe414196d2014-09-17 13:46:43 -070027 }
28
Jonathan Hart84f4f312016-03-03 08:17:11 -080029 /**
30 * Creates a flow ID from a long value.
31 *
32 * @param id long value
33 * @return flow ID
34 */
alshabib9290eea2014-09-22 11:58:17 -070035 public static FlowId valueOf(long id) {
Ayaka Koshibe414196d2014-09-17 13:46:43 -070036 return new FlowId(id);
37 }
38
Jonathan Hart84f4f312016-03-03 08:17:11 -080039 /**
40 * Gets the flow ID value.
41 *
42 * @return flow ID value as long
43 */
alshabiba7f7ca82014-09-22 11:41:23 -070044 public long value() {
Jian Lib6d998e2016-02-29 11:41:18 -080045 return this.identifier;
alshabiba7f7ca82014-09-22 11:41:23 -070046 }
Jonathan Hart84f4f312016-03-03 08:17:11 -080047
48 @Override
49 public String toString() {
50 return Long.toHexString(identifier);
51 }
Ayaka Koshibe414196d2014-09-17 13:46:43 -070052}