com.ibm.portal.streaming.json.helper
Class JsonUtils

java.lang.Object
  extended by com.ibm.portal.streaming.json.helper.JsonUtils

public abstract class JsonUtils
extends java.lang.Object

Some helper function for JSON support

Since:
8.0.0.1

Constructor Summary
JsonUtils()
           
 
Method Summary
static java.lang.Object getMember(java.lang.String name, java.lang.Object node)
          Returns the member of the object
static java.util.Set<java.lang.String> getMemberNames(java.lang.Object node)
          Returns the names of the members
static java.lang.Boolean toBoolean(java.lang.Object node)
          Converts the node to a boolean value
static java.lang.Double toDouble(java.lang.Object node)
          Converts the node to a double value
static java.lang.Float toFloat(java.lang.Object node)
          Converts the node to a float value
static java.lang.Integer toInteger(java.lang.Object node)
          Converts the node to an integer value
static java.util.List<?> toList(java.lang.Object node)
          Converts the node to a list
static java.lang.Long toLong(java.lang.Object node)
          Converts the node to a long value
static java.util.Map<java.lang.String,?> toMap(java.lang.Object node)
          Converts the node to a list
static java.lang.Number toNumber(java.lang.Object node)
          Converts the node to a number
static java.lang.String toString(java.lang.Object node)
          Converts the node to a string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonUtils

public JsonUtils()
Method Detail

getMember

public static java.lang.Object getMember(java.lang.String name,
                                         java.lang.Object node)
Returns the member of the object

Parameters:
name - the member name
node - the node
Returns:
the member

getMemberNames

public static java.util.Set<java.lang.String> getMemberNames(java.lang.Object node)
Returns the names of the members

Parameters:
node - the node
Returns:
the set of names, not null but may be empty
Since:
8.5

toBoolean

public static java.lang.Boolean toBoolean(java.lang.Object node)
Converts the node to a boolean value

Parameters:
node - the node
Returns:
the boolean value or null

toDouble

public static java.lang.Double toDouble(java.lang.Object node)
Converts the node to a double value

Parameters:
node - the node
Returns:
the double value or null

toFloat

public static java.lang.Float toFloat(java.lang.Object node)
Converts the node to a float value

Parameters:
node - the node
Returns:
the float value or null

toInteger

public static java.lang.Integer toInteger(java.lang.Object node)
Converts the node to an integer value

Parameters:
node - the node
Returns:
the integer value or null

toList

public static java.util.List<?> toList(java.lang.Object node)
Converts the node to a list

Parameters:
node - the node
Returns:
resulting list

toLong

public static java.lang.Long toLong(java.lang.Object node)
Converts the node to a long value

Parameters:
node - the node
Returns:
the long value or null

toMap

public static java.util.Map<java.lang.String,?> toMap(java.lang.Object node)
Converts the node to a list

Parameters:
node - the node
Returns:
resulting list

toNumber

public static java.lang.Number toNumber(java.lang.Object node)
Converts the node to a number

Parameters:
node - the node
Returns:
resulting number

toString

public static java.lang.String toString(java.lang.Object node)
Converts the node to a string

Parameters:
node - the node
Returns:
resulting string