public class JsonNodeFactory extends Object implements Serializable, JsonNodeCreator
| Modifier and Type | Field and 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.
|
| Modifier | Constructor and Description |
|---|---|
protected |
JsonNodeFactory()
Default constructor
|
|
JsonNodeFactory(boolean bigDecimalExact)
Main constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
_inIntRange(long l) |
ArrayNode |
arrayNode()
Factory method for constructing an empty JSON Array node
|
ArrayNode |
arrayNode(int capacity)
Factory method for constructing a JSON Array node with an initial capacity
|
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 |
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
|
BooleanNode |
booleanNode(boolean v)
Factory method for getting an instance of JSON boolean value
(either literal 'true' or 'false')
|
JsonNode |
missingNode() |
NullNode |
nullNode()
Factory method for getting an instance of JSON null node (which
represents literal null value)
|
ValueNode |
numberNode(BigDecimal v)
Factory method for getting an instance of JSON numeric value
that expresses given unlimited precision floating point value
|
ValueNode |
numberNode(BigInteger v)
Factory method for getting an instance of JSON numeric value
that expresses given unlimited range integer value
|
NumericNode |
numberNode(byte v)
Factory method for getting an instance of JSON numeric value
that expresses given 8-bit value
|
ValueNode |
numberNode(Byte value)
Alternate factory method that will handle wrapper value, which may
be null.
|
NumericNode |
numberNode(double v)
Factory method for getting an instance of JSON numeric value
that expresses given 64-bit floating point value
|
ValueNode |
numberNode(Double value)
Alternate factory method that will handle wrapper value, which may
be null.
|
NumericNode |
numberNode(float v)
Factory method for getting an instance of JSON numeric value
that expresses given 32-bit floating point value
|
ValueNode |
numberNode(Float value)
Alternate factory method that will handle wrapper value, which may
be null.
|
NumericNode |
numberNode(int v)
Factory method for getting an instance of JSON numeric value
that expresses given 32-bit integer value
|
ValueNode |
numberNode(Integer value)
Alternate factory method that will handle wrapper value, which may
be null.
|
NumericNode |
numberNode(long v)
Factory method for getting an instance of JSON numeric value
that expresses given 64-bit integer value
|
ValueNode |
numberNode(Long v)
Alternate factory method that will handle wrapper value, which may be null.
|
NumericNode |
numberNode(short v)
Factory method for getting an instance of JSON numeric value
that expresses given 16-bit integer value
|
ValueNode |
numberNode(Short value)
Alternate factory method that will handle wrapper value, which may
be null.
|
ObjectNode |
objectNode()
Factory method for constructing an empty JSON Object ("struct") node
|
ValueNode |
pojoNode(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.
|
ValueNode |
rawValueNode(RawValue value)
Factory method to use for adding "raw values"; pre-encoded values
that are included exactly as-is when node is serialized.
|
TextNode |
textNode(String text)
Factory method for constructing a node that represents JSON
String value
|
static JsonNodeFactory |
withExactBigDecimals(boolean bigDecimalExact)
Return a factory instance with the desired behavior for BigDecimals
|
public static final JsonNodeFactory instance
public JsonNodeFactory(boolean bigDecimalExact)
The only argument to this constructor is a boolean telling whether
DecimalNode instances must be built with exact representations of
BigDecimal instances.
This has quite an influence since, for instance, a BigDecimal (and,
therefore, a DecimalNode) constructed from input string "1.0" and
another constructed with input string "1.00" will not be
equal, since their scale differs (1 in the first case, 2 in the second
case).
Note that setting the argument to true does not
guarantee a strict inequality between JSON representations: input texts
"0.1" and "1e-1", for instance, yield two equivalent
BigDecimal instances since they have the same scale (1).
The no-arg constructor (and the default instance) calls this
constructor with false as an argument.
bigDecimalExact - see descriptionBigDecimalprotected JsonNodeFactory()
This calls JsonNodeFactory(boolean) with false
as an argument.
public static JsonNodeFactory withExactBigDecimals(boolean bigDecimalExact)
See JsonNodeFactory(boolean) for a full description.
bigDecimalExact - see descriptionpublic BooleanNode booleanNode(boolean v)
booleanNode in interface JsonNodeCreatorpublic NullNode nullNode()
nullNode in interface JsonNodeCreatorpublic JsonNode missingNode()
public NumericNode numberNode(byte v)
numberNode in interface JsonNodeCreatorpublic ValueNode numberNode(Byte value)
NumericNode, but just ValueNode.numberNode in interface JsonNodeCreatorpublic NumericNode numberNode(short v)
numberNode in interface JsonNodeCreatorpublic ValueNode numberNode(Short value)
NumericNode, but just ValueNode.numberNode in interface JsonNodeCreatorpublic NumericNode numberNode(int v)
numberNode in interface JsonNodeCreatorpublic ValueNode numberNode(Integer value)
NumericNode, but just ValueNode.numberNode in interface JsonNodeCreatorpublic NumericNode numberNode(long v)
numberNode in interface JsonNodeCreatorpublic ValueNode numberNode(Long v)
NumericNode, but just ValueNode.numberNode in interface JsonNodeCreatorpublic ValueNode numberNode(BigInteger v)
numberNode in interface JsonNodeCreatorpublic NumericNode numberNode(float v)
numberNode in interface JsonNodeCreatorpublic ValueNode numberNode(Float value)
NumericNode, but just ValueNode.numberNode in interface JsonNodeCreatorpublic NumericNode numberNode(double v)
numberNode in interface JsonNodeCreatorpublic ValueNode numberNode(Double value)
NumericNode, but just ValueNode.numberNode in interface JsonNodeCreatorpublic ValueNode numberNode(BigDecimal v)
In the event that the factory has been built to normalize decimal
values, the BigDecimal argument will be stripped off its trailing zeroes,
using BigDecimal.stripTrailingZeros().
numberNode in interface JsonNodeCreatorJsonNodeFactory(boolean)public TextNode textNode(String text)
textNode in interface JsonNodeCreatorpublic BinaryNode binaryNode(byte[] data)
binaryNode in interface JsonNodeCreatorpublic BinaryNode binaryNode(byte[] data, int offset, int length)
binaryNode in interface JsonNodeCreatorpublic ArrayNode arrayNode()
arrayNode in interface JsonNodeCreatorpublic ArrayNode arrayNode(int capacity)
arrayNode in interface JsonNodeCreatorpublic ObjectNode objectNode()
objectNode in interface JsonNodeCreatorpublic ValueNode pojoNode(Object pojo)
pojoNode in interface JsonNodeCreatorpublic ValueNode rawValueNode(RawValue value)
JsonNodeCreatorrawValueNode in interface JsonNodeCreatorprotected boolean _inIntRange(long l)
Copyright © 2008–2021 FasterXML. All rights reserved.