intent-details command

- Intended to be used by ONOS-5221, ONOS-5827

Change-Id: I33ab29946907e1963cc66c451d5f1aa77760f4fe
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentId.java b/core/api/src/main/java/org/onosproject/net/intent/IntentId.java
index c86471d..9799b78 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentId.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentId.java
@@ -16,6 +16,9 @@
 package org.onosproject.net.intent;
 
 import com.google.common.annotations.Beta;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
 import org.onlab.util.Identifier;
 import org.onosproject.net.resource.ResourceConsumer;
 import org.onosproject.net.resource.ResourceConsumerId;
@@ -27,6 +30,8 @@
 @Beta
 public final class IntentId extends Identifier<Long> implements ResourceConsumer {
 
+    private static final String HEX_PREFIX = "0x";
+
     /**
      * Creates an intent identifier from the specified long representation.
      *
@@ -38,6 +43,17 @@
     }
 
     /**
+     * Creates an intent identifier from the specified String representation.
+     *
+     * @param id hexadecimal String prefixed with 0x
+     * @return intent identifier
+     */
+    public static IntentId valueOf(String id) {
+        checkArgument(id.startsWith(HEX_PREFIX), "Invalid id: %s", id);
+        return valueOf(Long.parseUnsignedLong(id.substring(2), 16));
+    }
+
+    /**
      * Constructor for serializer.
      */
     IntentId() {
@@ -64,7 +80,7 @@
 
     @Override
     public String toString() {
-        return "0x" + Long.toHexString(identifier);
+        return HEX_PREFIX + Long.toHexString(identifier);
     }
 
     @Override