Top Description Fields Constructors Methods
tools.jackson.databind.node

public abstract Class ValueNode

extends BaseJsonNode
Class Inheritance
Known Direct Subclasses
tools.jackson.databind.node.BinaryNode, tools.jackson.databind.node.BooleanNode, tools.jackson.databind.node.NullNode, tools.jackson.databind.node.NumericNode, tools.jackson.databind.node.POJONode, tools.jackson.databind.node.StringNode
Imports
java.math.BigDecimal, .BigInteger, java.util.List, tools.jackson.core.*, tools.jackson.core.type.WritableTypeId, tools.jackson.databind.JsonNode, .SerializationContext, tools.jackson.databind.jsontype.TypeSerializer

This intermediate base class is used for all leaf nodes, that is, all non-container (array or object) nodes, except for the "missing node".

Field Summary

Modifier and TypeField and Description
protected static final BigDecimal
protected static final BigDecimal
protected static final BigDecimal
protected static final BigDecimal
protected static final BigDecimal
protected static final BigDecimal
protected static final BigInteger
protected static final BigInteger
protected static final BigInteger
protected static final BigInteger
protected static final BigInteger
protected static final BigInteger
protected static final JsonNode
private static final long
Inherited from tools.jackson.databind.node.BaseJsonNode:
OPT_FALSEOPT_TRUE

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected JsonNode
_at(JsonPointer ptr)

Implements abstract tools.jackson.databind.JsonNode._at.

Helper method used by other methods for traversing the next step of given path expression, and returning matching value node if any: if no match, null is returned.

public abstract JsonToken
asToken()

Redeclares tools.jackson.core.TreeNode.asToken.

Implements abstract tools.jackson.databind.node.BaseJsonNode.asToken.

Method that can be used for efficient type detection when using stream abstraction for traversing nodes.

public ValueNode
deepCopy()

Implements abstract tools.jackson.databind.JsonNode.deepCopy.

All current value nodes are immutable, so we can just return them as is.

public final ObjectNode
findParent(String fieldName)

Implements abstract tools.jackson.databind.JsonNode.findParent.

Method for finding a JSON Object that contains specified field, within this node or its descendants.

public final List<JsonNode>
findParents(String fieldName, List<JsonNode> foundSoFar)

Implements abstract tools.jackson.databind.JsonNode.findParents.

public final JsonNode
findValue(String fieldName)

Implements abstract tools.jackson.databind.JsonNode.findValue.

Method for finding the first JSON Object field with specified name in this node or its child nodes, and returning value it has.

public final List<JsonNode>
findValues(String fieldName, List<JsonNode> foundSoFar)

Implements abstract tools.jackson.databind.JsonNode.findValues.

public final List<String>
public final JsonNode
get(int index)

Implements abstract tools.jackson.databind.JsonNode.get.

Implements tools.jackson.core.TreeNode.get.

Method for accessing value of the specified element of an array node.

public final JsonNode
get(String fieldName)

Overrides tools.jackson.databind.JsonNode.get.

Implements tools.jackson.core.TreeNode.get.

Method for accessing value of the specified field of an object node.

public final boolean
has(int index)

Overrides tools.jackson.databind.JsonNode.has.

Method that allows checking whether this node is JSON Array node and contains a value for specified index If this is the case (including case of specified indexing having null as value), returns true; otherwise returns false.

public final boolean
has(String fieldName)

Overrides tools.jackson.databind.JsonNode.has.

Method that allows checking whether this node is JSON Object node and contains value for specified property.

public final boolean
hasNonNull(int index)

Overrides tools.jackson.databind.JsonNode.hasNonNull.

Method that is similar to has(int), but that will return false for explicitly added nulls.

public final boolean
hasNonNull(String fieldName)

Overrides tools.jackson.databind.JsonNode.hasNonNull.

Method that is similar to has(String), but that will return false for explicitly added nulls.

public boolean
isEmpty()

Overrides tools.jackson.databind.JsonNode.isEmpty.

Convenience method that is functionally same as:

    size() == 0
public final JsonNode
path(int index)

Implements abstract tools.jackson.databind.JsonNode.path.

Implements tools.jackson.core.TreeNode.path.

This method is similar to get(int), except that instead of returning null if no such element exists (due to index being out of range, or this node not being an array), a "missing node" (node that returns true for isMissingNode) will be returned.

public final JsonNode
path(String fieldName)

Implements abstract tools.jackson.databind.JsonNode.path.

Implements tools.jackson.core.TreeNode.path.

This method is similar to get(String), except that instead of returning null if no such value exists (due to this node not being an object, or object not having value for the specified field), a "missing node" (node that returns true for isMissingNode) will be returned.

public void
serializeWithType(JsonGenerator g, SerializationContext ctxt, TypeSerializer typeSer)

Implements abstract tools.jackson.databind.node.BaseJsonNode.serializeWithType.

Implements tools.jackson.databind.JacksonSerializable.serializeWithType.

Type information is needed, even if JsonNode instances are "plain" JSON, since they may be mixed with other types.

Inherited from tools.jackson.databind.node.BaseJsonNode:
_asBoolean_asString_jsonPointerIfValid_reportBigDecimalCoercionNaNFail_reportBigIntegerCoercionFractionFail_reportBigIntegerCoercionNaNFail_reportCoercionFail_reportDoubleCoercionRangeFail_reportFloatCoercionRangeFail_reportIntCoercionFractionFail_reportIntCoercionNaNFail_reportIntCoercionRangeFail_reportLongCoercionFractionFail_reportLongCoercionNaNFail_reportLongCoercionRangeFail_reportShortCoercionFractionFail_reportShortCoercionRangeFail_reportWrongNodeType_valueDesc_withArray_withObject_withXxxMayReplace_withXxxVerifyReplaceasBigIntegerasBigIntegerasBigIntegerOptasBooleanasBooleanasBooleanOptasDecimalasDecimalasDecimalOptasDoubleasDoubleasDoubleOptasFloatasFloatasFloatOptasIntasIntasIntOptasLongasLongasLongOptasShortasShortasShortOptasStringasStringasStringOptbigIntegerValuebigIntegerValuebigIntegerValueOptbinaryValuebooleanValuebooleanValuebooleanValueOptdecimalValuedecimalValuedecimalValueOptdoubleValuedoubleValuedoubleValueOptfindPathfloatValuefloatValuefloatValueOpthashCodeintValueintValueintValueOptisEmbeddedValueisMissingNodelongValuelongValuelongValueOptnumberTypenumberValuerequiredrequiredserializeshortValueshortValueshortValueOptstringValuestringValuestringValueOpttoPrettyStringtoStringtraversewithArraywithObjectwriteReplace

Field Detail

BD_MAX_INTEGERback to summary
protected static final BigDecimal BD_MAX_INTEGER
BD_MAX_LONGback to summary
protected static final BigDecimal BD_MAX_LONG
BD_MAX_SHORTback to summary
protected static final BigDecimal BD_MAX_SHORT
BD_MIN_INTEGERback to summary
protected static final BigDecimal BD_MIN_INTEGER
BD_MIN_LONGback to summary
protected static final BigDecimal BD_MIN_LONG
BD_MIN_SHORTback to summary
protected static final BigDecimal BD_MIN_SHORT
BI_MAX_INTEGERback to summary
protected static final BigInteger BI_MAX_INTEGER
BI_MAX_LONGback to summary
protected static final BigInteger BI_MAX_LONG
BI_MAX_SHORTback to summary
protected static final BigInteger BI_MAX_SHORT
BI_MIN_INTEGERback to summary
protected static final BigInteger BI_MIN_INTEGER
BI_MIN_LONGback to summary
protected static final BigInteger BI_MIN_LONG
BI_MIN_SHORTback to summary
protected static final BigInteger BI_MIN_SHORT
MISSINGback to summary
protected static final JsonNode MISSING
serialVersionUIDback to summary
private static final long serialVersionUID

Hides tools.jackson.databind.node.BaseJsonNode.serialVersionUID.

Constructor Detail

ValueNodeback to summary
protected ValueNode()

Method Detail

_atback to summary
protected JsonNode _at(JsonPointer ptr)

Implements abstract tools.jackson.databind.JsonNode._at.

Doc from tools.jackson.databind.JsonNode._at.

Helper method used by other methods for traversing the next step of given path expression, and returning matching value node if any: if no match, null is returned.

Annotations
@Override
asTokenback to summary
public abstract JsonToken asToken()

Redeclares tools.jackson.core.TreeNode.asToken.

Implements abstract tools.jackson.databind.node.BaseJsonNode.asToken.

Doc from tools.jackson.databind.node.BaseJsonNode.asToken.

Method that can be used for efficient type detection when using stream abstraction for traversing nodes. Will return the first JsonToken that equivalent stream event would produce (for most nodes there is just one token but for structured/container types multiple)

Annotations
@Override
deepCopyback to summary
public ValueNode deepCopy()

Implements abstract tools.jackson.databind.JsonNode.deepCopy.

All current value nodes are immutable, so we can just return them as is.

Annotations
@Override
findParentback to summary
public final ObjectNode findParent(String fieldName)

Implements abstract tools.jackson.databind.JsonNode.findParent.

Doc from tools.jackson.databind.JsonNode.findParent.

Method for finding a JSON Object that contains specified field, within this node or its descendants. If no matching field is found in this node or its descendants, returns null.

Annotations
@Override
findParentsback to summary
public final List<JsonNode> findParents(String fieldName, List<JsonNode> foundSoFar)

Implements abstract tools.jackson.databind.JsonNode.findParents.

Annotations
@Override
findValueback to summary
public final JsonNode findValue(String fieldName)

Implements abstract tools.jackson.databind.JsonNode.findValue.

Doc from tools.jackson.databind.JsonNode.findValue.

Method for finding the first JSON Object field with specified name in this node or its child nodes, and returning value it has. If no matching field is found in this node or its descendants, returns null.

Note that traversal is done in document order (that is, order in which nodes are iterated if using JsonNode#values())

Annotations
@Override
findValuesback to summary
public final List<JsonNode> findValues(String fieldName, List<JsonNode> foundSoFar)

Implements abstract tools.jackson.databind.JsonNode.findValues.

Annotations
@Override
findValuesAsStringback to summary
public final List<String> findValuesAsString(String fieldName, List<String> foundSoFar)

Implements abstract tools.jackson.databind.JsonNode.findValuesAsString.

Annotations
@Override
getback to summary
public final JsonNode get(int index)

Implements abstract tools.jackson.databind.JsonNode.get.

Implements tools.jackson.core.TreeNode.get.

Doc from tools.jackson.databind.JsonNode.get.

Method 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!), a tools.jackson.databind.node.NullNode will be returned, not null.

Annotations
@Override
getback to summary
public final JsonNode get(String fieldName)

Overrides tools.jackson.databind.JsonNode.get.

Implements tools.jackson.core.TreeNode.get.

Doc from tools.jackson.databind.JsonNode.get.

Method 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!), a tools.jackson.databind.node.NullNode will be returned, not null.

Annotations
@Override
hasback to summary
public final boolean has(int index)

Overrides tools.jackson.databind.JsonNode.has.

Doc from tools.jackson.databind.JsonNode.has.

Method that allows checking whether this node is JSON Array node and contains a value for specified index If this is the case (including case of specified indexing having null as value), returns true; otherwise returns false.

Note

array element indexes are 0-based.

This method is equivalent to:

   node.get(index) != null

Note

this method will return true for explicitly added null values.

Annotations
@Override
hasback to summary
public final boolean has(String fieldName)

Overrides tools.jackson.databind.JsonNode.has.

Doc from tools.jackson.databind.JsonNode.has.

Method that allows checking whether this node is JSON Object node and contains value for specified property. If this is the case (including properties with explicit null values), returns true; otherwise returns false.

This method is equivalent to:

   node.get(propertyName) != null
(since return value of get() is node, not value node contains)

Note

when explicit null values are added, this method will return true for such properties.

Annotations
@Override
hasNonNullback to summary
public final boolean hasNonNull(int index)

Overrides tools.jackson.databind.JsonNode.hasNonNull.

Doc from tools.jackson.databind.JsonNode.hasNonNull.

Method that is similar to has(int), but that will return false for explicitly added nulls.

This method is equivalent to:

   node.get(index) != null && !node.get(index).isNull()
Annotations
@Override
hasNonNullback to summary
public final boolean hasNonNull(String fieldName)

Overrides tools.jackson.databind.JsonNode.hasNonNull.

Doc from tools.jackson.databind.JsonNode.hasNonNull.

Method that is similar to has(String), but that will return false for explicitly added nulls.

This method is functionally equivalent to:

   node.get(propertyName) != null && !node.get(propertyName).isNull()
Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Overrides tools.jackson.databind.JsonNode.isEmpty.

Doc from tools.jackson.databind.JsonNode.isEmpty.

Convenience method that is functionally same as:

    size() == 0
for all node types.
Annotations
@Override
pathback to summary
public final JsonNode path(int index)

Implements abstract tools.jackson.databind.JsonNode.path.

Implements tools.jackson.core.TreeNode.path.

Doc from tools.jackson.databind.JsonNode.path.

This method is similar to get(int), except that instead of returning null if no such element exists (due to index being out of range, or this node not being an array), a "missing node" (node that returns true for isMissingNode) will be returned. This allows for convenient and safe chained access via path calls.

Annotations
@Override
pathback to summary
public final JsonNode path(String fieldName)

Implements abstract tools.jackson.databind.JsonNode.path.

Implements tools.jackson.core.TreeNode.path.

Doc from tools.jackson.databind.JsonNode.path.

This method is similar to get(String), except that instead of returning null if no such value exists (due to this node not being an object, or object not having value for the specified field), a "missing node" (node that returns true for isMissingNode) will be returned. This allows for convenient and safe chained access via path calls.

Annotations
@Override
serializeWithTypeback to summary
public void serializeWithType(JsonGenerator g, SerializationContext ctxt, TypeSerializer typeSer) throws JacksonException

Implements abstract tools.jackson.databind.node.BaseJsonNode.serializeWithType.

Implements tools.jackson.databind.JacksonSerializable.serializeWithType.

Doc from tools.jackson.databind.node.BaseJsonNode.serializeWithType.

Type information is needed, even if JsonNode instances are "plain" JSON, since they may be mixed with other types.

Annotations
@Override