blob: 4c372f39d34d43f95f578c2d6084251e85249b0d [file] [log] [blame]
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2014-present Open Networking Foundation
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -08003 *
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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.core;
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080017
Prince Pereira3ff504c2016-08-30 14:23:43 +053018import com.google.common.base.MoreObjects;
19import org.onlab.util.Identifier;
20
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080021/**
22 * Group identifier.
23 */
Prince Pereira3ff504c2016-08-30 14:23:43 +053024public class GroupId extends Identifier<Integer> {
25
26 public GroupId(int id) {
27 super(id);
28 }
29
30 // Constructor for serialization
31 private GroupId() {
32 super(0);
33 }
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080034
35 /**
Saurav Das100e3b82015-04-30 11:12:10 -070036 * Returns a group ID as an integer value.
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080037 * The method is not intended for use by application developers.
38 * Return data type may change in the future release.
39 *
Prince Pereira3ff504c2016-08-30 14:23:43 +053040 * @param id int value
41 * @return group ID
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080042 */
Prince Pereira3ff504c2016-08-30 14:23:43 +053043 public static GroupId valueOf(int id) {
44 return new GroupId(id);
45 }
46
47 @Override
48 public String toString() {
49 return MoreObjects.toStringHelper(this)
50 .add("id", "0x" + Integer.toHexString(identifier))
51 .toString();
52 }
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080053}