public abstract class ContainerNode<T extends ContainerNode<T>> extends BaseJsonNode implements JsonNodeCreator
JsonSerializable.Base
Modifier and Type | Method and Description |
---|---|
ArrayNode |
arrayNode()
Factory method that constructs and returns an empty
ArrayNode
Construction is done using registered JsonNodeFactory . |
ArrayNode |
arrayNode(int capacity)
Factory method that constructs and returns an
ArrayNode with an initial capacity
Construction is done using registered JsonNodeFactory |
java.lang.String |
asText()
Method that will return a valid String representation of
the container value, if the node is a value node
(method
JsonNode.isValueNode() returns true),
otherwise empty String. |
abstract JsonToken |
asToken()
Method that can be used for efficient type detection
when using stream abstraction for traversing nodes.
|
BinaryNode |
binaryNode(byte[] data) |
BinaryNode |
binaryNode(byte[] data,
int offset,
int length) |
BooleanNode |
booleanNode(boolean v) |
abstract JsonNode |
get(int index)
Method for accessing value of the specified element of
an array node.
|
abstract JsonNode |
get(java.lang.String fieldName)
Method for accessing value of the specified field of
an object node.
|
JsonNode |
missingNode() |
NullNode |
nullNode() |
ValueNode |
numberNode(java.math.BigDecimal v) |
ValueNode |
numberNode(java.math.BigInteger v) |
NumericNode |
numberNode(byte v) |
ValueNode |
numberNode(java.lang.Byte v) |
NumericNode |
numberNode(double v) |
ValueNode |
numberNode(java.lang.Double v) |
NumericNode |
numberNode(float v) |
ValueNode |
numberNode(java.lang.Float v) |
NumericNode |
numberNode(int v) |
ValueNode |
numberNode(java.lang.Integer v) |
NumericNode |
numberNode(long v) |
ValueNode |
numberNode(java.lang.Long v) |
NumericNode |
numberNode(short v) |
ValueNode |
numberNode(java.lang.Short v) |
ObjectNode |
objectNode()
Factory method that constructs and returns an empty
ObjectNode
Construction is done using registered JsonNodeFactory . |
ValueNode |
pojoNode(java.lang.Object pojo) |
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.
|
abstract T |
removeAll()
Method for removing all children container has (if any)
|
abstract int |
size()
Method that returns number of child nodes this node contains:
for Array nodes, number of child elements, for Object nodes,
number of fields, and for all other nodes 0.
|
TextNode |
textNode(java.lang.String text) |
findPath, hashCode, numberType, required, required, serialize, serializeWithType, toPrettyString, toString, traverse, traverse
asBoolean, asBoolean, asDouble, asDouble, asInt, asInt, asLong, asLong, asText, at, at, bigIntegerValue, binaryValue, booleanValue, canConvertToInt, canConvertToLong, decimalValue, deepCopy, doubleValue, elements, equals, equals, fieldNames, fields, findParent, findParents, findParents, findValue, findValues, findValues, findValuesAsText, findValuesAsText, floatValue, getNodeType, has, has, hasNonNull, hasNonNull, intValue, isArray, isBigDecimal, isBigInteger, isBinary, isBoolean, isContainerNode, isDouble, isEmpty, isFloat, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isMissingNode, isNull, isNumber, isObject, isPojo, isShort, isTextual, isValueNode, iterator, longValue, numberValue, path, path, require, requiredAt, requiredAt, requireNonNull, shortValue, textValue, with, withArray
isEmpty
public abstract JsonToken asToken()
BaseJsonNode
JsonToken
that equivalent
stream event would produce (for most nodes there is just
one token but for structured/container types multiple)asToken
in interface TreeNode
asToken
in class BaseJsonNode
public java.lang.String asText()
JsonNode
JsonNode.isValueNode()
returns true),
otherwise empty String.public abstract int size()
TreeNode
public abstract JsonNode get(int index)
JsonNode
For array nodes, index specifies
exact location within array and allows for efficient iteration
over child elements (underlying storage is guaranteed to
be efficiently indexable, i.e. has random-access to elements).
If index is less than 0, or equal-or-greater than
node.size()
, null is returned; no exception is
thrown for any index.
NOTE: if the element value has been explicitly set as null
(which is different from removal!),
a NullNode
will be returned,
not null.
public abstract JsonNode get(java.lang.String fieldName)
JsonNode
NOTE: if the property value has been explicitly set as null
(which is different from removal!),
a NullNode
will be returned,
not null.
public final BooleanNode booleanNode(boolean v)
booleanNode
in interface JsonNodeCreator
public JsonNode missingNode()
public final NullNode nullNode()
nullNode
in interface JsonNodeCreator
public final ArrayNode arrayNode()
ArrayNode
Construction is done using registered JsonNodeFactory
.arrayNode
in interface JsonNodeCreator
public final ArrayNode arrayNode(int capacity)
ArrayNode
with an initial capacity
Construction is done using registered JsonNodeFactory
arrayNode
in interface JsonNodeCreator
capacity
- the initial capacity of the ArrayNodepublic final ObjectNode objectNode()
ObjectNode
Construction is done using registered JsonNodeFactory
.objectNode
in interface JsonNodeCreator
public final NumericNode numberNode(byte v)
numberNode
in interface JsonNodeCreator
public final NumericNode numberNode(short v)
numberNode
in interface JsonNodeCreator
public final NumericNode numberNode(int v)
numberNode
in interface JsonNodeCreator
public final NumericNode numberNode(long v)
numberNode
in interface JsonNodeCreator
public final NumericNode numberNode(float v)
numberNode
in interface JsonNodeCreator
public final NumericNode numberNode(double v)
numberNode
in interface JsonNodeCreator
public final ValueNode numberNode(java.math.BigInteger v)
numberNode
in interface JsonNodeCreator
public final ValueNode numberNode(java.math.BigDecimal v)
numberNode
in interface JsonNodeCreator
public final ValueNode numberNode(java.lang.Byte v)
numberNode
in interface JsonNodeCreator
public final ValueNode numberNode(java.lang.Short v)
numberNode
in interface JsonNodeCreator
public final ValueNode numberNode(java.lang.Integer v)
numberNode
in interface JsonNodeCreator
public final ValueNode numberNode(java.lang.Long v)
numberNode
in interface JsonNodeCreator
public final ValueNode numberNode(java.lang.Float v)
numberNode
in interface JsonNodeCreator
public final ValueNode numberNode(java.lang.Double v)
numberNode
in interface JsonNodeCreator
public final TextNode textNode(java.lang.String text)
textNode
in interface JsonNodeCreator
public final BinaryNode binaryNode(byte[] data)
binaryNode
in interface JsonNodeCreator
public final BinaryNode binaryNode(byte[] data, int offset, int length)
binaryNode
in interface JsonNodeCreator
public final ValueNode pojoNode(java.lang.Object pojo)
pojoNode
in interface JsonNodeCreator
public final ValueNode rawValueNode(RawValue value)
JsonNodeCreator
rawValueNode
in interface JsonNodeCreator
public abstract T removeAll()
Copyright © 2010 - 2020 Adobe. All Rights Reserved