java.lang.Object
tools.jackson.databind.node.JsonNodeFactory
- All Implemented Interfaces:
Serializable
,JsonNodeCreator
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.
Note that behavior of "exact BigDecimal value" (aka
"strip trailing zeroes of BigDecimal or not") changed in 3.0:
new JsonNodeFeature.STRIP_TRAILING_BIGDECIMAL_ZEROES
setting is used to externally configure this behavior.
Note, too, that this factory will no longer handle this normalization
(if enabled): caller (like JsonNodeDeserializer
)
is expected to handle it.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JsonNodeFactory
Default singleton instance that construct "standard" node instances: given that this class is stateless, a globally shared singleton can be used.protected static final int
Constant that defines maximumJsonPointer
element index we use for inserts. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
_inIntRange
(long l) Factory method for constructing an empty JSON Array nodearrayNode
(int capacity) Factory method for constructing a JSON Array node with an initial capacitybinaryNode
(byte[] data) Factory method for constructing a node that represents given binary data, and will get serialized as equivalent base64-encoded String valuebinaryNode
(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
(boolean v) Factory method for getting an instance of JSON boolean value (either literal 'true' or 'false')int
nullNode()
Factory method for getting an instance of JSON null node (which represents literal null value)numberNode
(byte v) Factory method for getting an instance of JSON numeric value that expresses given 8-bit valuenumberNode
(double v) Factory method for getting an instance of JSON numeric value that expresses given 64-bit floating point valuenumberNode
(float v) Factory method for getting an instance of JSON numeric value that expresses given 32-bit floating point valuenumberNode
(int v) Factory method for getting an instance of JSON numeric value that expresses given 32-bit integer valuenumberNode
(long v) Factory method for getting an instance of JSON numeric value that expresses given 64-bit integer valuenumberNode
(short v) Factory method for getting an instance of JSON numeric value that expresses given 16-bit integer valuenumberNode
(Byte value) Alternate factory method that will handle wrapper value, which may be null.numberNode
(Double value) Alternate factory method that will handle wrapper value, which may be null.numberNode
(Float value) Alternate factory method that will handle wrapper value, which may be null.numberNode
(Integer value) Alternate factory method that will handle wrapper value, which may be null.numberNode
(Long v) Alternate factory method that will handle wrapper value, which may be null.numberNode
(Short value) Alternate factory method that will handle wrapper value, which may be null.Factory method for getting an instance of JSON numeric value that expresses given unlimited precision floating point valueFactory method for getting an instance of JSON numeric value that expresses given unlimited range integer valueFactory method for constructing an empty JSON Object ("struct") nodeFactory 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.rawValueNode
(RawValue value) Factory method to use for adding "raw values"; pre-encoded values that are included exactly as-is when node is serialized.stringNode
(String text) Factory method for constructing a node that represents JSON String valueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface tools.jackson.databind.node.JsonNodeCreator
textNode
-
Field Details
-
MAX_ELEMENT_INDEX_FOR_INSERT
protected static final int MAX_ELEMENT_INDEX_FOR_INSERTConstant that defines maximumJsonPointer
element index we use for inserts.- See Also:
-
instance
Default singleton instance that construct "standard" node instances: given that this class is stateless, a globally shared singleton can be used.Default for 3.x is to make no changes; no normalization by default.
-
-
Constructor Details
-
JsonNodeFactory
public JsonNodeFactory()Default constructor.
-
-
Method Details
-
getMaxElementIndexForInsert
public int getMaxElementIndexForInsert() -
booleanNode
Factory method for getting an instance of JSON boolean value (either literal 'true' or 'false')- Specified by:
booleanNode
in interfaceJsonNodeCreator
-
missingNode
- Specified by:
missingNode
in interfaceJsonNodeCreator
-
nullNode
Factory method for getting an instance of JSON null node (which represents literal null value)- Specified by:
nullNode
in interfaceJsonNodeCreator
-
numberNode
Factory method for getting an instance of JSON numeric value that expresses given 8-bit value- Specified by:
numberNode
in interfaceJsonNodeCreator
-
numberNode
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
.- Specified by:
numberNode
in interfaceJsonNodeCreator
-
numberNode
Factory method for getting an instance of JSON numeric value that expresses given 16-bit integer value- Specified by:
numberNode
in interfaceJsonNodeCreator
-
numberNode
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
.- Specified by:
numberNode
in interfaceJsonNodeCreator
-
numberNode
Factory method for getting an instance of JSON numeric value that expresses given 32-bit integer value- Specified by:
numberNode
in interfaceJsonNodeCreator
-
numberNode
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
.- Specified by:
numberNode
in interfaceJsonNodeCreator
-
numberNode
Factory method for getting an instance of JSON numeric value that expresses given 64-bit integer value- Specified by:
numberNode
in interfaceJsonNodeCreator
-
numberNode
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
.- Specified by:
numberNode
in interfaceJsonNodeCreator
-
numberNode
Factory method for getting an instance of JSON numeric value that expresses given unlimited range integer value- Specified by:
numberNode
in interfaceJsonNodeCreator
-
numberNode
Factory method for getting an instance of JSON numeric value that expresses given 32-bit floating point value- Specified by:
numberNode
in interfaceJsonNodeCreator
-
numberNode
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
.- Specified by:
numberNode
in interfaceJsonNodeCreator
-
numberNode
Factory method for getting an instance of JSON numeric value that expresses given 64-bit floating point value- Specified by:
numberNode
in interfaceJsonNodeCreator
-
numberNode
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
.- Specified by:
numberNode
in interfaceJsonNodeCreator
-
numberNode
Factory method for getting an instance of JSON numeric value that expresses given unlimited precision floating point valueNote that no normalization is performed here; caller may choose to do that, based on
JsonNodeFeature.STRIP_TRAILING_BIGDECIMAL_ZEROES
setting.- Specified by:
numberNode
in interfaceJsonNodeCreator
-
stringNode
Factory method for constructing a node that represents JSON String value- Specified by:
stringNode
in interfaceJsonNodeCreator
-
binaryNode
Factory method for constructing a node that represents given binary data, and will get serialized as equivalent base64-encoded String value- Specified by:
binaryNode
in interfaceJsonNodeCreator
-
binaryNode
Factory method for constructing a node that represents given binary data, and will get serialized as equivalent base64-encoded String value- Specified by:
binaryNode
in interfaceJsonNodeCreator
-
arrayNode
Factory method for constructing an empty JSON Array node- Specified by:
arrayNode
in interfaceJsonNodeCreator
-
arrayNode
Factory method for constructing a JSON Array node with an initial capacity- Specified by:
arrayNode
in interfaceJsonNodeCreator
- Since:
- 2.8
-
objectNode
Factory method for constructing an empty JSON Object ("struct") node- Specified by:
objectNode
in interfaceJsonNodeCreator
-
pojoNode
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.- Specified by:
pojoNode
in interfaceJsonNodeCreator
-
rawValueNode
Description copied from interface:JsonNodeCreator
Factory method to use for adding "raw values"; pre-encoded values that are included exactly as-is when node is serialized. This may be used, for example, to include fully serialized JSON sub-trees. Note that the concept may not work with all backends, and since no translation of any kinds is done it will not work when converting between data formats.- Specified by:
rawValueNode
in interfaceJsonNodeCreator
-
_inIntRange
protected boolean _inIntRange(long l)
-