Package org.onosproject.ui
Class JsonUtils
- java.lang.Object
- 
- org.onosproject.ui.JsonUtils
 
- 
 public final class JsonUtils extends java.lang.ObjectProvides convenience methods for dealing with JSON nodes, arrays etc.
- 
- 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanbool(com.fasterxml.jackson.databind.node.ObjectNode node, java.lang.String name)Returns the specified node property as a boolean.static com.fasterxml.jackson.databind.node.ObjectNodeenvelope(java.lang.String type, com.fasterxml.jackson.databind.node.ObjectNode payload)Composes a message structure for the given message type and payload.static java.lang.StringeventType(com.fasterxml.jackson.databind.node.ObjectNode event)Returns the event type from the specified event.static com.fasterxml.jackson.databind.node.ObjectNodenode(com.fasterxml.jackson.databind.node.ObjectNode node, java.lang.String name)Returns the specified node property as an object node.static longnumber(com.fasterxml.jackson.databind.node.ObjectNode node, java.lang.String name)Returns the specified node property as a number.static com.fasterxml.jackson.databind.node.ObjectNodepayload(com.fasterxml.jackson.databind.node.ObjectNode event)Returns the payload from the specified event.static java.lang.Stringstring(com.fasterxml.jackson.databind.node.ObjectNode node, java.lang.String name)Returns the specified node property as a string.static java.lang.Stringstring(com.fasterxml.jackson.databind.node.ObjectNode node, java.lang.String name, java.lang.String defaultValue)Returns the specified node property as a string, with a default fallback.
 
- 
- 
- 
Method Detail- 
envelopepublic static com.fasterxml.jackson.databind.node.ObjectNode envelope(java.lang.String type, com.fasterxml.jackson.databind.node.ObjectNode payload)Composes a message structure for the given message type and payload.- Parameters:
- type- message type
- payload- message payload
- Returns:
- the object node representation
 
 - 
eventTypepublic static java.lang.String eventType(com.fasterxml.jackson.databind.node.ObjectNode event) Returns the event type from the specified event. If the node does not have an "event" property, "unknown" is returned.- Parameters:
- event- message event
- Returns:
- extracted event type
 
 - 
payloadpublic static com.fasterxml.jackson.databind.node.ObjectNode payload(com.fasterxml.jackson.databind.node.ObjectNode event) Returns the payload from the specified event.- Parameters:
- event- message event
- Returns:
- extracted payload object
 
 - 
numberpublic static long number(com.fasterxml.jackson.databind.node.ObjectNode node, java.lang.String name)Returns the specified node property as a number.- Parameters:
- node- object node
- name- property name
- Returns:
- property as number
 
 - 
stringpublic static java.lang.String string(com.fasterxml.jackson.databind.node.ObjectNode node, java.lang.String name)Returns the specified node property as a string.- Parameters:
- node- object node
- name- property name
- Returns:
- property as a string
 
 - 
stringpublic static java.lang.String string(com.fasterxml.jackson.databind.node.ObjectNode node, java.lang.String name, java.lang.String defaultValue)Returns the specified node property as a string, with a default fallback.- Parameters:
- node- object node
- name- property name
- defaultValue- fallback value if property is absent
- Returns:
- property as a string
 
 - 
nodepublic static com.fasterxml.jackson.databind.node.ObjectNode node(com.fasterxml.jackson.databind.node.ObjectNode node, java.lang.String name)Returns the specified node property as an object node.- Parameters:
- node- object node
- name- property name
- Returns:
- property as a node
 
 - 
boolpublic static boolean bool(com.fasterxml.jackson.databind.node.ObjectNode node, java.lang.String name)Returns the specified node property as a boolean.- Parameters:
- node- object node
- name- property name
- Returns:
- property as a boolean
 
 
- 
 
-