Class ValueNode
- All Implemented Interfaces:
TreeNode
,JsonSerializable
,Serializable
,Iterable<JsonNode>
- Direct Known Subclasses:
BinaryNode
,BooleanNode
,MissingNode
,NullNode
,NumericNode
,POJONode
,TextNode
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.JsonNode
JsonNode.OverwriteMode
Nested classes/interfaces inherited from interface edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.JsonSerializable
JsonSerializable.Base
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected JsonNode
_at
(JsonPointer ptr) 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.abstract JsonToken
asToken()
Method that can be used for efficient type detection when using stream abstraction for traversing nodes.<T extends JsonNode>
TdeepCopy()
All current value nodes are immutable, so we can just return them as is.final ObjectNode
findParent
(String fieldName) Method for finding a JSON Object that contains specified field, within this node or its descendants.findParents
(String fieldName, List<JsonNode> foundSoFar) final JsonNode
Method for finding a JSON Object field with specified name in this node or its child nodes, and returning value it has.findValues
(String fieldName, List<JsonNode> foundSoFar) findValuesAsText
(String fieldName, List<String> foundSoFar) final JsonNode
get
(int index) Method for accessing value of the specified element of an array node.final JsonNode
Method for accessing value of the specified field of an object node.final boolean
has
(int index) 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.final boolean
Method that allows checking whether this node is JSON Object node and contains value for specified property.final boolean
hasNonNull
(int index) Method that is similar toJsonNode.has(int)
, but that will returnfalse
for explicitly added nulls.final boolean
hasNonNull
(String fieldName) Method that is similar toJsonNode.has(String)
, but that will returnfalse
for explicitly added nulls.boolean
isEmpty()
Convenience method that is functionally same as:final JsonNode
path
(int index) This method is similar toJsonNode.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 forJsonNode.isMissingNode()
) will be returned.final JsonNode
This method is similar toJsonNode.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 forJsonNode.isMissingNode()
) will be returned.void
serializeWithType
(JsonGenerator g, SerializerProvider provider, TypeSerializer typeSer) Type information is needed, even if JsonNode instances are "plain" JSON, since they may be mixed with other types.Methods inherited from class edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.node.BaseJsonNode
_jsonPointerIfValid, _reportWrongNodeOperation, _reportWrongNodeType, _withArray, _withObject, _withXxxMayReplace, _withXxxVerifyReplace, findPath, hashCode, numberType, required, required, serialize, toPrettyString, toString, traverse, traverse, withArray, withObject
Methods inherited from class edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.JsonNode
_reportRequiredViolation, _this, asBoolean, asBoolean, asDouble, asDouble, asInt, asInt, asLong, asLong, asText, asText, at, at, bigIntegerValue, binaryValue, booleanValue, canConvertToExactIntegral, canConvertToInt, canConvertToLong, decimalValue, doubleValue, elements, equals, equals, fieldNames, fields, findParents, findValues, findValuesAsText, floatValue, getNodeType, intValue, isArray, isBigDecimal, isBigInteger, isBinary, isBoolean, isContainerNode, isDouble, isFloat, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isMissingNode, isNull, isNumber, isObject, isPojo, isShort, isTextual, isValueNode, iterator, longValue, numberValue, require, requiredAt, requiredAt, requireNonNull, shortValue, size, textValue, with, withArray, withArray, withArray, withObject, withObject, withObject
Methods inherited from class edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.JsonSerializable.Base
isEmpty
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ValueNode
protected ValueNode()
-
-
Method Details
-
_at
Description copied from class:JsonNode
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. -
deepCopy
All current value nodes are immutable, so we can just return them as is. -
asToken
Description copied from class:BaseJsonNode
Method that can be used for efficient type detection when using stream abstraction for traversing nodes. Will return the firstJsonToken
that equivalent stream event would produce (for most nodes there is just one token but for structured/container types multiple)- Specified by:
asToken
in interfaceTreeNode
- Specified by:
asToken
in classBaseJsonNode
- Returns:
JsonToken
that is most closely associated with the node type
-
serializeWithType
public void serializeWithType(JsonGenerator g, SerializerProvider provider, TypeSerializer typeSer) throws IOException Description copied from class:BaseJsonNode
Type information is needed, even if JsonNode instances are "plain" JSON, since they may be mixed with other types.- Specified by:
serializeWithType
in interfaceJsonSerializable
- Specified by:
serializeWithType
in classBaseJsonNode
- Throws:
IOException
-
isEmpty
public boolean isEmpty()Description copied from class:JsonNode
Convenience method that is functionally same as:size() == 0
for all node types. -
get
Description copied from class:JsonNode
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!), aNullNode
will be returned, not null. -
path
Description copied from class:JsonNode
This method is similar toJsonNode.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 forJsonNode.isMissingNode()
) will be returned. This allows for convenient and safe chained access via path calls. -
has
public final boolean has(int index) Description copied from class:JsonNode
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. -
hasNonNull
public final boolean hasNonNull(int index) Description copied from class:JsonNode
Method that is similar toJsonNode.has(int)
, but that will returnfalse
for explicitly added nulls.This method is equivalent to:
node.get(index) != null && !node.get(index).isNull()
- Overrides:
hasNonNull
in classJsonNode
-
get
Description copied from class:JsonNode
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!), aNullNode
will be returned, not null. -
path
Description copied from class:JsonNode
This method is similar toJsonNode.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 forJsonNode.isMissingNode()
) will be returned. This allows for convenient and safe chained access via path calls.- Specified by:
path
in interfaceTreeNode
- Specified by:
path
in classJsonNode
- Parameters:
fieldName
- Name of the field (of Object node) to access- Returns:
- Node that represent value of the specified field, if this node is an object and has value for the specified field; otherwise "missing node" is returned.
-
has
Description copied from class:JsonNode
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(fieldName) != null
(since return value of get() is node, not value node contains)NOTE: when explicit
null
values are added, this method will returntrue
for such properties. -
hasNonNull
Description copied from class:JsonNode
Method that is similar toJsonNode.has(String)
, but that will returnfalse
for explicitly added nulls.This method is functionally equivalent to:
node.get(fieldName) != null && !node.get(fieldName).isNull()
- Overrides:
hasNonNull
in classJsonNode
-
findValue
Description copied from class:JsonNode
Method for finding a 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. -
findParent
Description copied from class:JsonNode
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.- Specified by:
findParent
in classJsonNode
- Parameters:
fieldName
- Name of field to look for- Returns:
- Value of first matching node found, if any; null if none
-
findValues
- Specified by:
findValues
in classJsonNode
-
findValuesAsText
- Specified by:
findValuesAsText
in classJsonNode
-
findParents
- Specified by:
findParents
in classJsonNode
-