Package org.codehaus.jackson.node
Class JsonNodeFactory
- java.lang.Object
-
- org.codehaus.jackson.node.JsonNodeFactory
-
public class JsonNodeFactory extends java.lang.Object
Base class that specifies methods for getting access to Node instances (newly constructed, or shared, depending on type), as well as basic implementation of the methods. Designed to be sub-classed if extended functionality (additions to behavior of node types, mostly) is needed.
-
-
Field Summary
Fields Modifier and Type Field Description static JsonNodeFactory
instance
Default singleton instance that construct "standard" node instances: given that this class is stateless, a globally shared singleton can be used.
-
Constructor Summary
Constructors Modifier Constructor Description protected
JsonNodeFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArrayNode
arrayNode()
Factory method for constructing an empty JSON Array nodeBinaryNode
binaryNode(byte[] data)
Factory method for constructing a node that represents given binary data, and will get serialized as equivalent base64-encoded String valueBinaryNode
binaryNode(byte[] data, int offset, int length)
Factory method for constructing a node that represents given binary data, and will get serialized as equivalent base64-encoded String valueBooleanNode
booleanNode(boolean v)
Factory method for getting an instance of JSON boolean value (either literal 'true' or 'false')NullNode
nullNode()
Factory method for getting an instance of JSON null node (which represents literal null value)NumericNode
numberNode(byte v)
Factory method for getting an instance of JSON numeric value that expresses given 8-bit valueNumericNode
numberNode(double v)
Factory method for getting an instance of JSON numeric value that expresses given 64-bit floating point valueNumericNode
numberNode(float v)
Factory method for getting an instance of JSON numeric value that expresses given 32-bit floating point valueNumericNode
numberNode(int v)
Factory method for getting an instance of JSON numeric value that expresses given 32-bit integer valueNumericNode
numberNode(long v)
Factory method for getting an instance of JSON numeric value that expresses given 64-bit integer valueNumericNode
numberNode(short v)
Factory method for getting an instance of JSON numeric value that expresses given 16-bit integer valueValueNode
numberNode(java.lang.Byte value)
Alternate factory method that will handle wrapper value, which may be null.ValueNode
numberNode(java.lang.Double value)
Alternate factory method that will handle wrapper value, which may be null.ValueNode
numberNode(java.lang.Float value)
Alternate factory method that will handle wrapper value, which may be null.ValueNode
numberNode(java.lang.Integer value)
Alternate factory method that will handle wrapper value, which may be null.ValueNode
numberNode(java.lang.Long value)
Alternate factory method that will handle wrapper value, which may be null.ValueNode
numberNode(java.lang.Short value)
Alternate factory method that will handle wrapper value, which may be null.NumericNode
numberNode(java.math.BigDecimal v)
Factory method for getting an instance of JSON numeric value that expresses given unlimited precision floating point valueNumericNode
numberNode(java.math.BigInteger v)
Factory method for getting an instance of JSON numeric value that expresses given unlimited range integer valueObjectNode
objectNode()
Factory method for constructing an empty JSON Object ("struct") nodePOJONode
POJONode(java.lang.Object pojo)
Factory method for constructing a wrapper for POJO ("Plain Old Java Object") objects; these will get serialized using data binding, usually as JSON Objects, but in some cases as JSON Strings or other node types.TextNode
textNode(java.lang.String text)
Factory method for constructing a node that represents JSON String value
-
-
-
Field Detail
-
instance
public static final JsonNodeFactory instance
Default singleton instance that construct "standard" node instances: given that this class is stateless, a globally shared singleton can be used.
-
-
Method Detail
-
booleanNode
public BooleanNode booleanNode(boolean v)
Factory method for getting an instance of JSON boolean value (either literal 'true' or 'false')
-
nullNode
public NullNode nullNode()
Factory method for getting an instance of JSON null node (which represents literal null value)
-
numberNode
public NumericNode numberNode(byte v)
Factory method for getting an instance of JSON numeric value that expresses given 8-bit value
-
numberNode
public ValueNode numberNode(java.lang.Byte value)
Alternate factory method that will handle wrapper value, which may be null. Due to possibility of null, returning type is not guaranteed to beNumericNode
, but justValueNode
.- Since:
- 1.9
-
numberNode
public NumericNode numberNode(short v)
Factory method for getting an instance of JSON numeric value that expresses given 16-bit integer value
-
numberNode
public ValueNode numberNode(java.lang.Short value)
Alternate factory method that will handle wrapper value, which may be null. Due to possibility of null, returning type is not guaranteed to beNumericNode
, but justValueNode
.- Since:
- 1.9
-
numberNode
public NumericNode numberNode(int v)
Factory method for getting an instance of JSON numeric value that expresses given 32-bit integer value
-
numberNode
public ValueNode numberNode(java.lang.Integer value)
Alternate factory method that will handle wrapper value, which may be null. Due to possibility of null, returning type is not guaranteed to beNumericNode
, but justValueNode
.- Since:
- 1.9
-
numberNode
public NumericNode numberNode(long v)
Factory method for getting an instance of JSON numeric value that expresses given 64-bit integer value
-
numberNode
public ValueNode numberNode(java.lang.Long value)
Alternate factory method that will handle wrapper value, which may be null. Due to possibility of null, returning type is not guaranteed to beNumericNode
, but justValueNode
.- Since:
- 1.9
-
numberNode
public NumericNode numberNode(java.math.BigInteger v)
Factory method for getting an instance of JSON numeric value that expresses given unlimited range integer value
-
numberNode
public NumericNode numberNode(float v)
Factory method for getting an instance of JSON numeric value that expresses given 32-bit floating point value
-
numberNode
public ValueNode numberNode(java.lang.Float value)
Alternate factory method that will handle wrapper value, which may be null. Due to possibility of null, returning type is not guaranteed to beNumericNode
, but justValueNode
.- Since:
- 1.9
-
numberNode
public NumericNode numberNode(double v)
Factory method for getting an instance of JSON numeric value that expresses given 64-bit floating point value
-
numberNode
public ValueNode numberNode(java.lang.Double value)
Alternate factory method that will handle wrapper value, which may be null. Due to possibility of null, returning type is not guaranteed to beNumericNode
, but justValueNode
.- Since:
- 1.9
-
numberNode
public NumericNode numberNode(java.math.BigDecimal v)
Factory method for getting an instance of JSON numeric value that expresses given unlimited precision floating point value
-
textNode
public TextNode textNode(java.lang.String text)
Factory method for constructing a node that represents JSON String value
-
binaryNode
public BinaryNode binaryNode(byte[] data)
Factory method for constructing a node that represents given binary data, and will get serialized as equivalent base64-encoded String value
-
binaryNode
public BinaryNode binaryNode(byte[] data, int offset, int length)
Factory method for constructing a node that represents given binary data, and will get serialized as equivalent base64-encoded String value
-
arrayNode
public ArrayNode arrayNode()
Factory method for constructing an empty JSON Array node
-
objectNode
public ObjectNode objectNode()
Factory method for constructing an empty JSON Object ("struct") node
-
POJONode
public POJONode POJONode(java.lang.Object pojo)
Factory method for constructing a wrapper for POJO ("Plain Old Java Object") objects; these will get serialized using data binding, usually as JSON Objects, but in some cases as JSON Strings or other node types.
-
-