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

public final Class MissingNode

extends BaseJsonNode
Class Inheritance
Imports
java.util.List, .Optional, tools.jackson.core.*, tools.jackson.databind.JsonNode, .SerializationContext, tools.jackson.databind.jsontype.TypeSerializer

This singleton node class is generated to denote "missing nodes" along paths that do not exist. For example, if a path via element of an array is requested for an element outside range of elements in the array; or for a non-array value, result will be reference to this node.

In most respects this placeholder node will act as NullNode; for example, for purposes of value conversions, value is considered to be null and represented as value zero when used for numeric conversions.

Field Summary

Modifier and TypeField and Description
private static final MissingNode
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.

protected String
_valueDesc()

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

Method for implementation classes to return a short description of contained value, to be used in error messages.

public Optional<JsonNode>
asOptional()

Overrides tools.jackson.databind.JsonNode.asOptional.

Method that will return a JsonNode wrapped in Java's Optional.

public JsonToken
asToken()

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

Implements tools.jackson.core.TreeNode.asToken.

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

public MissingNode
deepCopy()

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

Method that can be called to get a node that is guaranteed not to allow changing of this node through mutators on this node or any of its children.

public boolean
equals(Object o)

Implements abstract tools.jackson.databind.JsonNode.equals.

Equality for node objects is defined as full (deep) value equality.

public JsonNode
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 List<JsonNode>
findParents(String fieldName, List<JsonNode> foundSoFar)

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

public 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 List<JsonNode>
findValues(String fieldName, List<JsonNode> foundSoFar)

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

public List<String>
public 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 static MissingNode
public JsonNodeType
getNodeType()

Implements abstract tools.jackson.databind.JsonNode.getNodeType.

Return the type of this node

public int
hashCode()

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

Returns a hash code value for this object.

public final boolean
isMissingNode()

Overrides tools.jackson.databind.node.BaseJsonNode.isMissingNode.

Implements tools.jackson.core.TreeNode.isMissingNode.

Method that returns true for "virtual" nodes which represent missing entries constructed by path accessor methods when there is no actual node matching given criteria.

public 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 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.

protected Object
public JsonNode
require()

Overrides tools.jackson.databind.JsonNode.require.

Method that may be called to verify that this node is NOT so-called "missing node": that is, one for which isMissingNode() returns true.

public JsonNode
requireNonNull()

Overrides tools.jackson.databind.JsonNode.requireNonNull.

Method that may be called to verify that this node is neither so-called "missing node" (that is, one for which isMissingNode() returns true) nor "null node" (one for which isNull() returns true).

public final void
serialize(JsonGenerator g, SerializationContext provider)

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

Implements tools.jackson.databind.JacksonSerializable.serialize.

Method called to serialize node instances using given generator.

public void
serializeWithType(JsonGenerator g, SerializationContext provider, 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.

public String
toPrettyString()

Overrides tools.jackson.databind.node.BaseJsonNode.toPrettyString.

Alternative to toString that will serialize this node using Jackson default pretty-printer.

public String
toString()

Overrides tools.jackson.databind.node.BaseJsonNode.toString.

Method that will produce (as of Jackson 2.10) valid JSON using default settings of databind, as String.

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_withArray_withObject_withXxxMayReplace_withXxxVerifyReplaceasBigIntegerasBigIntegerasBigIntegerOptasBooleanasBooleanasBooleanOptasDecimalasDecimalasDecimalOptasDoubleasDoubleasDoubleOptasFloatasFloatasFloatOptasIntasIntasIntOptasLongasLongasLongOptasShortasShortasShortOptasStringasStringasStringOptbigIntegerValuebigIntegerValuebigIntegerValueOptbinaryValuebooleanValuebooleanValuebooleanValueOptdecimalValuedecimalValuedecimalValueOptdoubleValuedoubleValuedoubleValueOptfindPathfloatValuefloatValuefloatValueOptintValueintValueintValueOptisEmbeddedValuelongValuelongValuelongValueOptnumberTypenumberValuerequiredrequiredshortValueshortValueshortValueOptstringValuestringValuestringValueOpttraversewithArraywithObjectwriteReplace

Field Detail

instanceback to summary
private static final MissingNode instance
serialVersionUIDback to summary
private static final long serialVersionUID

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

Constructor Detail

MissingNodeback to summary
protected MissingNode()

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
_valueDescback to summary
protected String _valueDesc()

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

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

Method for implementation classes to return a short description of contained value, to be used in error messages.

Annotations
@Override
asOptionalback to summary
public Optional<JsonNode> asOptional()

Overrides tools.jackson.databind.JsonNode.asOptional.

Doc from tools.jackson.databind.JsonNode.asOptional.

Method that will return a JsonNode wrapped in Java's Optional. All nodes except of MissingNode will return non-empty Optional; MissingNode will return empty Optional.

Annotations
@Override
asTokenback to summary
public JsonToken asToken()

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

Implements tools.jackson.core.TreeNode.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 MissingNode deepCopy()

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

Doc from tools.jackson.databind.JsonNode.deepCopy.

Method that can be called to get a node that is guaranteed not to allow changing of this node through mutators on this node or any of its children. This means it can either make a copy of this node (and all mutable children and grand children nodes), or node itself if it is immutable.

Note

return type is guaranteed to have same type as the node method is called on; which is why method is declared with local generic type.

Annotations
@Override
equalsback to summary
public boolean equals(Object o)

Implements abstract tools.jackson.databind.JsonNode.equals.

Doc from tools.jackson.databind.JsonNode.equals.

Equality for node objects is defined as full (deep) value equality. This means that it is possible to compare complete JSON trees for equality by comparing equality of root nodes.

Note

marked as abstract to ensure all implementation classes define it properly and not rely on definition from java.lang.Object.

Annotations
@Override
findParentback to summary
public JsonNode 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 List<JsonNode> findParents(String fieldName, List<JsonNode> foundSoFar)

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

Annotations
@Override
findValueback to summary
public 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 List<JsonNode> findValues(String fieldName, List<JsonNode> foundSoFar)

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

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

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

Annotations
@Override
getback to summary
public 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
getInstanceback to summary
public static MissingNode getInstance()
getNodeTypeback to summary
public JsonNodeType getNodeType()

Implements abstract tools.jackson.databind.JsonNode.getNodeType.

Doc from tools.jackson.databind.JsonNode.getNodeType.

Return the type of this node

Annotations
@Override
hashCodeback to summary
public int hashCode()

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

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
isMissingNodeback to summary
public final boolean isMissingNode()

Overrides tools.jackson.databind.node.BaseJsonNode.isMissingNode.

Implements tools.jackson.core.TreeNode.isMissingNode.

Doc from tools.jackson.core.TreeNode.isMissingNode.

Method that returns true for "virtual" nodes which represent missing entries constructed by path accessor methods when there is no actual node matching given criteria.

Note

one and only one of methods isValueNode, isContainer() and isMissingNode ever returns true for any given node.

Annotations
@Override
pathback to summary
public 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
pathback to summary
public 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
readResolveback to summary
protected Object readResolve()
requireback to summary
public JsonNode require()

Overrides tools.jackson.databind.JsonNode.require.

Doc from tools.jackson.databind.JsonNode.require.

Method that may be called to verify that this node is NOT so-called "missing node": that is, one for which isMissingNode() returns true. If not missing node, this is returned to allow chaining; otherwise exception is thrown.

Annotations
@SuppressWarnings:unchecked
@Override
requireNonNullback to summary
public JsonNode requireNonNull()

Overrides tools.jackson.databind.JsonNode.requireNonNull.

Doc from tools.jackson.databind.JsonNode.requireNonNull.

Method that may be called to verify that this node is neither so-called "missing node" (that is, one for which isMissingNode() returns true) nor "null node" (one for which isNull() returns true). If non-null non-missing node, this is returned to allow chaining; otherwise exception is thrown.

Annotations
@SuppressWarnings:unchecked
@Override
serializeback to summary
public final void serialize(JsonGenerator g, SerializationContext provider) throws JacksonException

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

Implements tools.jackson.databind.JacksonSerializable.serialize.

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

Method called to serialize node instances using given generator.

Annotations
@Override
serializeWithTypeback to summary
public void serializeWithType(JsonGenerator g, SerializationContext provider, 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
toPrettyStringback to summary
public String toPrettyString()

Overrides tools.jackson.databind.node.BaseJsonNode.toPrettyString.

Doc from tools.jackson.databind.JsonNode.toPrettyString.

Alternative to toString that will serialize this node using Jackson default pretty-printer.

Annotations
@Override
toStringback to summary
public String toString()

Overrides tools.jackson.databind.node.BaseJsonNode.toString.

Doc from tools.jackson.databind.JsonNode.toString.

Method that will produce (as of Jackson 2.10) valid JSON using default settings of databind, as String. If you want other kinds of JSON output (or output formatted using one of other Jackson-supported data formats) make sure to use ObjectMapper or ObjectWriter to serialize an instance, for example:

   String json = objectMapper.writeValueAsString(rootNode);

Note

method defined as abstract to ensure all implementation classes explicitly implement method, instead of relying on Object#toString() definition.

Annotations
@Override