Class ContainerNode<T extends ContainerNode<T>>
java.lang.Object
com.fasterxml.jackson.databind.JsonSerializable.Base
com.fasterxml.jackson.databind.JsonNode
com.fasterxml.jackson.databind.node.BaseJsonNode
com.fasterxml.jackson.databind.node.ContainerNode<T>
- All Implemented Interfaces:
TreeNode,JsonSerializable,JsonNodeCreator,Serializable,Iterable<JsonNode>
- Direct Known Subclasses:
ArrayNode,ObjectNode
public abstract class ContainerNode<T extends ContainerNode<T>>
extends BaseJsonNode
implements JsonNodeCreator
This intermediate base class is used for all container nodes,
specifically, array and object nodes.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonNode
JsonNode.OverwriteModeNested classes/interfaces inherited from interface com.fasterxml.jackson.databind.JsonSerializable
JsonSerializable.Base -
Method Summary
Modifier and TypeMethodDescriptionfinal ArrayNodeFactory method that constructs and returns an emptyArrayNodeConstruction is done using registeredJsonNodeFactory.final ArrayNodearrayNode(int capacity) Factory method that constructs and returns anArrayNodewith an initial capacity Construction is done using registeredJsonNodeFactoryasText()Method that will return a valid String representation of the container value, if the node is a value node (methodJsonNode.isValueNode()returns true), otherwise empty String.abstract JsonTokenasToken()Method that can be used for efficient type detection when using stream abstraction for traversing nodes.final BinaryNodebinaryNode(byte[] data) final BinaryNodebinaryNode(byte[] data, int offset, int length) final BooleanNodebooleanNode(boolean v) abstract JsonNodeget(int index) Method for accessing value of the specified element of an array node.abstract JsonNodeMethod for accessing value of the specified field of an object node.final NullNodenullNode()final NumericNodenumberNode(byte v) final NumericNodenumberNode(double v) final NumericNodenumberNode(float v) final NumericNodenumberNode(int v) final NumericNodenumberNode(long v) final NumericNodenumberNode(short v) final ValueNodenumberNode(Byte v) final ValueNodenumberNode(Double v) final ValueNodenumberNode(Float v) final ValueNodefinal ValueNodenumberNode(Long v) final ValueNodenumberNode(Short v) final ValueNodefinal ValueNodefinal ObjectNodeFactory method that constructs and returns an emptyObjectNodeConstruction is done using registeredJsonNodeFactory.final ValueNodefinal ValueNoderawValueNode(RawValue value) Factory method to use for adding "raw values"; pre-encoded values that are included exactly as-is when node is serialized.abstract TMethod for removing all children container has (if any)abstract intsize()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.final TextNodeMethods inherited from class com.fasterxml.jackson.databind.node.BaseJsonNode
findPath, hashCode, numberType, required, required, serialize, serializeWithType, toPrettyString, toString, traverse, traverse, withArray, withObjectMethods inherited from class com.fasterxml.jackson.databind.JsonNode
asBoolean, asBoolean, asDouble, asDouble, asInt, asInt, asLong, asLong, asText, at, at, bigIntegerValue, binaryValue, booleanValue, canConvertToExactIntegral, 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, properties, require, requiredAt, requiredAt, requireNonNull, shortValue, textValue, with, withArray, withArray, withArray, withArrayProperty, withObject, withObject, withObject, withObjectPropertyMethods inherited from class com.fasterxml.jackson.databind.JsonSerializable.Base
isEmptyMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
asToken
Description copied from class:BaseJsonNodeMethod that can be used for efficient type detection when using stream abstraction for traversing nodes. Will return the firstJsonTokenthat equivalent stream event would produce (for most nodes there is just one token but for structured/container types multiple)- Specified by:
asTokenin interfaceTreeNode- Specified by:
asTokenin classBaseJsonNode- Returns:
JsonTokenthat is most closely associated with the node type
-
asText
Description copied from class:JsonNodeMethod that will return a valid String representation of the container value, if the node is a value node (methodJsonNode.isValueNode()returns true), otherwise empty String. -
size
public abstract int size()Description copied from interface:TreeNodeMethod 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. -
get
Description copied from class:JsonNodeMethod for accessing value of the specified element of an array node. For other nodes, null is always returned.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!), aNullNodewill be returned, not null. -
get
Description copied from class:JsonNodeMethod for accessing value of the specified field of an object node. If this node is not an object (or it does not have a value for specified field name), or if there is no field with such name, null is returned.NOTE: if the property value has been explicitly set as
null(which is different from removal!), aNullNodewill be returned, not null. -
booleanNode
- Specified by:
booleanNodein interfaceJsonNodeCreator
-
missingNode
-
nullNode
- Specified by:
nullNodein interfaceJsonNodeCreator
-
arrayNode
Factory method that constructs and returns an emptyArrayNodeConstruction is done using registeredJsonNodeFactory.- Specified by:
arrayNodein interfaceJsonNodeCreator
-
arrayNode
Factory method that constructs and returns anArrayNodewith an initial capacity Construction is done using registeredJsonNodeFactory- Specified by:
arrayNodein interfaceJsonNodeCreator- Parameters:
capacity- the initial capacity of the ArrayNode
-
objectNode
Factory method that constructs and returns an emptyObjectNodeConstruction is done using registeredJsonNodeFactory.- Specified by:
objectNodein interfaceJsonNodeCreator
-
numberNode
- Specified by:
numberNodein interfaceJsonNodeCreator
-
numberNode
- Specified by:
numberNodein interfaceJsonNodeCreator
-
numberNode
- Specified by:
numberNodein interfaceJsonNodeCreator
-
numberNode
- Specified by:
numberNodein interfaceJsonNodeCreator
-
numberNode
- Specified by:
numberNodein interfaceJsonNodeCreator
-
numberNode
- Specified by:
numberNodein interfaceJsonNodeCreator
-
numberNode
- Specified by:
numberNodein interfaceJsonNodeCreator
-
numberNode
- Specified by:
numberNodein interfaceJsonNodeCreator
-
numberNode
- Specified by:
numberNodein interfaceJsonNodeCreator
-
numberNode
- Specified by:
numberNodein interfaceJsonNodeCreator
-
numberNode
- Specified by:
numberNodein interfaceJsonNodeCreator
-
numberNode
- Specified by:
numberNodein interfaceJsonNodeCreator
-
numberNode
- Specified by:
numberNodein interfaceJsonNodeCreator
-
numberNode
- Specified by:
numberNodein interfaceJsonNodeCreator
-
textNode
- Specified by:
textNodein interfaceJsonNodeCreator
-
binaryNode
- Specified by:
binaryNodein interfaceJsonNodeCreator
-
binaryNode
- Specified by:
binaryNodein interfaceJsonNodeCreator
-
pojoNode
- Specified by:
pojoNodein interfaceJsonNodeCreator
-
rawValueNode
Description copied from interface:JsonNodeCreatorFactory 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:
rawValueNodein interfaceJsonNodeCreator
-
removeAll
Method for removing all children container has (if any)- Returns:
- Container node itself (to allow method call chaining)
-