argo.jdom
Class JsonNodeFactories

java.lang.Object
  extended by argo.jdom.JsonNodeFactories

public final class JsonNodeFactories
extends java.lang.Object

Factories for JsonNodes.


Method Summary
static JsonRootNode array(java.lang.Iterable<? extends JsonNode> elements)
           
static JsonRootNode array(JsonNode... elements)
           
static JsonNode booleanNode(boolean value)
           
static JsonNode falseNode()
           
static JsonField field(JsonStringNode name, JsonNode value)
           
static JsonField field(java.lang.String name, JsonNode value)
           
static JsonRootNode lazyArray(java.util.List<? extends JsonNode> elements)
          Generates an array where the members are only evaluated on request.
static JsonRootNode lazyObject(java.util.List<JsonField> fields)
          Generates an object where the members are only evaluated on request.
static JsonNode nullNode()
           
static JsonNode number(java.math.BigDecimal value)
           
static JsonNode number(java.math.BigInteger value)
           
static JsonNode number(long value)
           
static JsonNode number(java.lang.String value)
           
static JsonRootNode object(java.lang.Iterable<JsonField> fields)
           
static JsonRootNode object(JsonField... fields)
           
static JsonRootNode object(java.util.Map<JsonStringNode,? extends JsonNode> fields)
           
static JsonStringNode string(java.lang.String value)
           
static JsonNode trueNode()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

nullNode

public static JsonNode nullNode()
Returns:
a JSON null

trueNode

public static JsonNode trueNode()
Returns:
a JSON true

falseNode

public static JsonNode falseNode()
Returns:
a JSON false

string

public static JsonStringNode string(java.lang.String value)
Parameters:
value - the Java String to represent as a JSON string
Returns:
a JSON string representation of the given String

number

public static JsonNode number(java.lang.String value)
Parameters:
value - a Java String to represent as a JSON number
Returns:
a JSON number representation of the given String

number

public static JsonNode number(java.math.BigDecimal value)
Parameters:
value - a Java BigDecimal to represent as a JSON number
Returns:
a JSON number representation of the given BigDecimal

number

public static JsonNode number(java.math.BigInteger value)
Parameters:
value - a Java BigInteger to represent as a JSON number
Returns:
a JSON number representation of the given BigInteger

number

public static JsonNode number(long value)
Parameters:
value - a Java long to represent as a JSON number
Returns:
a JSON number representation of the given BigInteger

array

public static JsonRootNode array(java.lang.Iterable<? extends JsonNode> elements)
Parameters:
elements - JsonNodes that will populate the array
Returns:
a JSON array of the given JsonNodes

array

public static JsonRootNode array(JsonNode... elements)
Parameters:
elements - JsonNodes that will populate the array
Returns:
a JSON array of the given JsonNodes

lazyArray

public static JsonRootNode lazyArray(java.util.List<? extends JsonNode> elements)
Generates an array where the members are only evaluated on request. This means that arrays generated by this method might not be immutable, depending on the implementation of List used in the argument. If you supply a list of elements, and then add an item to the list, that item will also be part of the array.

Parameters:
elements - JsonNodes that will populate the array
Returns:
a JSON array of the given JsonNodes

object

public static JsonRootNode object(java.util.Map<JsonStringNode,? extends JsonNode> fields)
Parameters:
fields - JsonFields that the object will contain
Returns:
a JSON object containing the given fields

object

public static JsonRootNode object(JsonField... fields)
Parameters:
fields - JsonFields that the object will contain
Returns:
a JSON object containing the given fields

object

public static JsonRootNode object(java.lang.Iterable<JsonField> fields)
Parameters:
fields - JsonFields that the object will contain
Returns:
a JSON object containing the given fields

lazyObject

public static JsonRootNode lazyObject(java.util.List<JsonField> fields)
Generates an object where the members are only evaluated on request. This means that objects generated by this method might not be immutable, depending on the implementation of List used in the argument. If you supply a list of fields, and then add an item to the list, that item will also be part of the object.

Parameters:
fields - JsonFields that the object will contain
Returns:
a JSON object containing the given fields

field

public static JsonField field(java.lang.String name,
                              JsonNode value)
Parameters:
name - the name of the field
value - the value of the field
Returns:
a JSON field with the given name and value

field

public static JsonField field(JsonStringNode name,
                              JsonNode value)
Parameters:
name - the name of the field
value - the value of the field
Returns:
a JSON field with the given name and value

booleanNode

public static JsonNode booleanNode(boolean value)
Parameters:
value - the Java boolean to represent as a JSON Boolean
Returns:
a JSON Boolean representation of the given boolean