Top Description Inners Constructors Methods
tools.jackson.jr.stree

public abstract Class JrsValue

extends Object
implements TreeNode
Class Inheritance
All Implemented Interfaces
tools.jackson.core.TreeNode
Known Direct Subclasses
tools.jackson.jr.stree.JrsValue.Scalar, tools.jackson.jr.stree.JrsArray, tools.jackson.jr.stree.JrsMissing, tools.jackson.jr.stree.JrsObject
Imports
java.util.Collection, .Collections, tools.jackson.core.*, tools.jackson.jr.stree.util.JrsTreeTraversingParser

Shared base class for all "simple" node types of Jackson Jr "simple tree" package; implements TreeNode and is usable via matching tools.jackson.core.TreeCodec implementation (see JacksonJrsTreeCodec).

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
JrsValue.Scalar

Intermediate base class for non-structured types, other than JrsMissing.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected abstract JrsValue
public String
asText()

Method that may be called on scalar value nodes to get a textual representation of contents.

public JrsValue
at(JsonPointer ptr)

Implements tools.jackson.core.TreeNode.at.

Method for locating node specified by given JSON pointer instances.

public JrsValue
at(String s)

Implements tools.jackson.core.TreeNode.at.

Convenience method that is functionally equivalent to:

   return at(JsonPointer.valueOf(jsonPointerExpression));
public abstract JrsValue
get(String s)

Redeclares tools.jackson.core.TreeNode.get.

Method for accessing value of the specified property of an Object node.

public abstract JrsValue
get(int i)

Redeclares tools.jackson.core.TreeNode.get.

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

public boolean
isArray()

Implements tools.jackson.core.TreeNode.isArray.

Method that returns true if this node is an Array node, false otherwise.

public boolean
isEmbeddedValue()

Implements tools.jackson.core.TreeNode.isEmbeddedValue.

Method that returns true if this node represents an embedded "foreign" (or perhaps native?) object (like POJO), not represented as regular content.

public boolean
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 boolean
isNull()

Implements tools.jackson.core.TreeNode.isNull.

Method that returns true if this node is a node that represents logical null value.

public boolean
isNumber()

Method that allows checking whether this value is a JSON number (integer or floating-point).

public boolean
isObject()

Implements tools.jackson.core.TreeNode.isObject.

Method that returns true if this node is an Object node, false otherwise.

public JsonParser.NumberType
numberType()

Implements tools.jackson.core.TreeNode.numberType.

If this node is a numeric type (as per JsonToken#isNumeric), returns native type that node uses to store the numeric value; otherwise returns null.

public abstract JrsValue
path(String s)

Redeclares tools.jackson.core.TreeNode.path.

Method for accessing value of the specified property of an Object node.

public abstract JrsValue
path(int i)

Redeclares tools.jackson.core.TreeNode.path.

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

public Collection<String>
propertyNames()

Implements tools.jackson.core.TreeNode.propertyNames.

Method for accessing names of all properties for this node, if (and only if) this node is an Object node.

public JsonParser
traverse(ObjectReadContext ctxt)

Implements tools.jackson.core.TreeNode.traverse.

Method for constructing a JsonParser instance for iterating over contents of the tree that this node is root of.

protected abstract void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

JrsValueback to summary
public JrsValue()

Method Detail

_atback to summary
protected abstract JrsValue _at(JsonPointer ptr)
asTextback to summary
public String asText()

Method that may be called on scalar value nodes to get a textual representation of contents. Returns `null` for structured values (Arrays, Objects), textual representation for other types.

atback to summary
public JrsValue at(JsonPointer ptr)

Implements tools.jackson.core.TreeNode.at.

Doc from tools.jackson.core.TreeNode.at.

Method for locating node specified by given JSON pointer instances. Method will never return null; if no matching node exists, will return a node for which TreeNode#isMissingNode() returns true.

Annotations
@Override
atback to summary
public JrsValue at(String s)

Implements tools.jackson.core.TreeNode.at.

Doc from tools.jackson.core.TreeNode.at.

Convenience method that is functionally equivalent to:

   return at(JsonPointer.valueOf(jsonPointerExpression));

Note that if the same expression is used often, it is preferable to construct JsonPointer instance once and reuse it: this method will not perform any caching of compiled expressions.

Annotations
@Override
getback to summary
public abstract JrsValue get(String s)

Redeclares tools.jackson.core.TreeNode.get.

Doc from tools.jackson.core.TreeNode.get.

Method for accessing value of the specified property of an Object node. If this node is not an Object (or it does not have a value for specified property) null is returned.

Note

handling of explicit null values may vary between implementations; some trees may retain explicit nulls, others not.

Annotations
@Override
getback to summary
public abstract JrsValue get(int i)

Redeclares tools.jackson.core.TreeNode.get.

Doc from tools.jackson.core.TreeNode.get.

Method for accessing value of the specified element of an array node. For other nodes, null is 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.

Annotations
@Override
isArrayback to summary
public boolean isArray()

Implements tools.jackson.core.TreeNode.isArray.

Doc from tools.jackson.core.TreeNode.isArray.

Method that returns true if this node is an Array node, false otherwise. Note that if true is returned, isContainer() must also return true.

Annotations
@Override
isEmbeddedValueback to summary
public boolean isEmbeddedValue()

Implements tools.jackson.core.TreeNode.isEmbeddedValue.

Doc from tools.jackson.core.TreeNode.isEmbeddedValue.

Method that returns true if this node represents an embedded "foreign" (or perhaps native?) object (like POJO), not represented as regular content. Such nodes are used to pass information that either native format cannot express as-is, metadata not included within at all, or something else that requires special handling.

Annotations
@Override
isMissingNodeback to summary
public boolean 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
isNullback to summary
public boolean isNull()

Implements tools.jackson.core.TreeNode.isNull.

Doc from tools.jackson.core.TreeNode.isNull.

Method that returns true if this node is a node that represents logical null value.

Annotations
@Override
isNumberback to summary
public boolean isNumber()

Method that allows checking whether this value is a JSON number (integer or floating-point).

isObjectback to summary
public boolean isObject()

Implements tools.jackson.core.TreeNode.isObject.

Doc from tools.jackson.core.TreeNode.isObject.

Method that returns true if this node is an Object node, false otherwise. Note that if true is returned, isContainer() must also return true.

Annotations
@Override
numberTypeback to summary
public JsonParser.NumberType numberType()

Implements tools.jackson.core.TreeNode.numberType.

Doc from tools.jackson.core.TreeNode.numberType.

If this node is a numeric type (as per JsonToken#isNumeric), returns native type that node uses to store the numeric value; otherwise returns null.

Annotations
@Override
pathback to summary
public abstract JrsValue path(String s)

Redeclares tools.jackson.core.TreeNode.path.

Doc from tools.jackson.core.TreeNode.path.

Method for accessing value of the specified property of an Object node. For other nodes, a "missing node" (virtual node for which isMissingNode returns true) is returned.

Annotations
@Override
pathback to summary
public abstract JrsValue path(int i)

Redeclares tools.jackson.core.TreeNode.path.

Doc from tools.jackson.core.TreeNode.path.

Method for accessing value of the specified element of an array node. For other nodes, a "missing node" (virtual node for which isMissingNode returns true) is 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(), "missing node" is returned; no exception is thrown for any index.

Annotations
@Override
propertyNamesback to summary
public Collection<String> propertyNames()

Implements tools.jackson.core.TreeNode.propertyNames.

Doc from tools.jackson.core.TreeNode.propertyNames.

Method for accessing names of all properties for this node, if (and only if) this node is an Object node. Number of property names accessible will be size.

Annotations
@Override
traverseback to summary
public JsonParser traverse(ObjectReadContext ctxt)

Implements tools.jackson.core.TreeNode.traverse.

Doc from tools.jackson.core.TreeNode.traverse.

Method for constructing a JsonParser instance for iterating over contents of the tree that this node is root of. Functionally equivalent to first serializing tree and then re-parsing but more efficient.

Note

constructed parser instance will NOT initially point to a token, so before passing it to deserializers, it is typically necessary to advance it to the first available token by calling JsonParser#nextToken().

Annotations
@Override
writeback to summary
protected abstract void write(JsonGenerator g, JacksonJrsTreeCodec codec) throws JacksonException
tools.jackson.jr.stree back to summary

public abstract Class JrsValue.Scalar

extends JrsValue
Class Inheritance
Known Direct Subclasses
tools.jackson.jr.stree.JrsBoolean, tools.jackson.jr.stree.JrsEmbeddedObject, tools.jackson.jr.stree.JrsNull, tools.jackson.jr.stree.JrsNumber, tools.jackson.jr.stree.JrsString

Intermediate base class for non-structured types, other than JrsMissing.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected JrsValue
public JrsValue
get(String s)

Implements abstract tools.jackson.jr.stree.JrsValue.get.

Implements tools.jackson.core.TreeNode.get.

Method for accessing value of the specified property of an Object node.

public JrsValue
get(int i)

Implements abstract tools.jackson.jr.stree.JrsValue.get.

Implements tools.jackson.core.TreeNode.get.

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

public final boolean
isContainer()

Implements tools.jackson.core.TreeNode.isContainer.

Method that returns true for container nodes: Arrays and Objects.

public final boolean
isValueNode()

Implements tools.jackson.core.TreeNode.isValueNode.

Method that returns true for all value nodes: ones that are not containers, and that do not represent "missing" nodes in the path.

public JrsValue
path(String s)

Implements abstract tools.jackson.jr.stree.JrsValue.path.

Implements tools.jackson.core.TreeNode.path.

Method for accessing value of the specified property of an Object node.

public JrsValue
path(int i)

Implements abstract tools.jackson.jr.stree.JrsValue.path.

Implements tools.jackson.core.TreeNode.path.

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

public int
size()

Implements tools.jackson.core.TreeNode.size.

Method that returns number of child nodes this node contains: for Array nodes, number of child elements, for Object nodes, number of properties, and for all other nodes 0.

Inherited from tools.jackson.jr.stree.JrsValue:
asTextatatisArrayisEmbeddedValueisMissingNodeisNullisNumberisObjectnumberTypepropertyNamestraversewrite

Constructor Detail

Scalarback to summary
public Scalar()

Method Detail

_atback to summary
protected JrsValue _at(JsonPointer ptr)

Implements abstract tools.jackson.jr.stree.JrsValue._at.

Annotations
@Override
getback to summary
public JrsValue get(String s)

Implements abstract tools.jackson.jr.stree.JrsValue.get.

Implements tools.jackson.core.TreeNode.get.

Doc from tools.jackson.core.TreeNode.get.

Method for accessing value of the specified property of an Object node. If this node is not an Object (or it does not have a value for specified property) null is returned.

Note

handling of explicit null values may vary between implementations; some trees may retain explicit nulls, others not.

Annotations
@Override
getback to summary
public JrsValue get(int i)

Implements abstract tools.jackson.jr.stree.JrsValue.get.

Implements tools.jackson.core.TreeNode.get.

Doc from tools.jackson.core.TreeNode.get.

Method for accessing value of the specified element of an array node. For other nodes, null is 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.

Annotations
@Override
isContainerback to summary
public final boolean isContainer()

Implements tools.jackson.core.TreeNode.isContainer.

Doc from tools.jackson.core.TreeNode.isContainer.

Method that returns true for container nodes: Arrays and Objects.

Note

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

Annotations
@Override
isValueNodeback to summary
public final boolean isValueNode()

Implements tools.jackson.core.TreeNode.isValueNode.

Doc from tools.jackson.core.TreeNode.isValueNode.

Method that returns true for all value nodes: ones that are not containers, and that do not represent "missing" nodes in the path. Such value nodes represent String, Number, Boolean and null values from JSON.

Note

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

Annotations
@Override
pathback to summary
public JrsValue path(String s)

Implements abstract tools.jackson.jr.stree.JrsValue.path.

Implements tools.jackson.core.TreeNode.path.

Doc from tools.jackson.core.TreeNode.path.

Method for accessing value of the specified property of an Object node. For other nodes, a "missing node" (virtual node for which isMissingNode returns true) is returned.

Annotations
@Override
pathback to summary
public JrsValue path(int i)

Implements abstract tools.jackson.jr.stree.JrsValue.path.

Implements tools.jackson.core.TreeNode.path.

Doc from tools.jackson.core.TreeNode.path.

Method for accessing value of the specified element of an array node. For other nodes, a "missing node" (virtual node for which isMissingNode returns true) is 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(), "missing node" is returned; no exception is thrown for any index.

Annotations
@Override
sizeback to summary
public int size()

Implements tools.jackson.core.TreeNode.size.

Doc from tools.jackson.core.TreeNode.size.

Method that returns number of child nodes this node contains: for Array nodes, number of child elements, for Object nodes, number of properties, and for all other nodes 0.

Annotations
@Override