Fix for ONOS-5175. GroupId refactoring.
Change-Id: I951392bdc69fe1ef694d321164b0b49032617d6b
diff --git a/core/api/src/main/java/org/onosproject/core/GroupId.java b/core/api/src/main/java/org/onosproject/core/GroupId.java
index 2ab398b..c2a9d26 100644
--- a/core/api/src/main/java/org/onosproject/core/GroupId.java
+++ b/core/api/src/main/java/org/onosproject/core/GroupId.java
@@ -15,18 +15,39 @@
*/
package org.onosproject.core;
+import com.google.common.base.MoreObjects;
+import org.onlab.util.Identifier;
+
/**
* Group identifier.
*/
-// TODO: require refactor to extend from Identifier base class
-public interface GroupId {
+public class GroupId extends Identifier<Integer> {
+
+ public GroupId(int id) {
+ super(id);
+ }
+
+ // Constructor for serialization
+ private GroupId() {
+ super(0);
+ }
/**
* Returns a group ID as an integer value.
* The method is not intended for use by application developers.
* Return data type may change in the future release.
*
- * @return a group ID as integer value
+ * @param id int value
+ * @return group ID
*/
- int id();
+ public static GroupId valueOf(int id) {
+ return new GroupId(id);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("id", "0x" + Integer.toHexString(identifier))
+ .toString();
+ }
}