- All Implemented Interfaces:
Serializable
,Iterable<JsonNode>
,tools.jackson.core.TreeNode
,JacksonSerializable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.databind.JsonNode
JsonNode.OverwriteMode
Nested classes/interfaces inherited from interface tools.jackson.databind.JacksonSerializable
JacksonSerializable.Base
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Method for implementation classes to return a short description of contained value, to be used in error messages.boolean
Method that will try to convert value of this node to a Java boolean.boolean
asBoolean
(boolean defaultValue) Method that will try to convert value of this node to a Java boolean.double
asDouble
(double defaultValue) Method that will try to convert value of this node to a Java double.int
asInt
(int defaultValue) Method that will try to convert value of this node to a Java int.long
asLong
(long defaultValue) Method that will try to convert value of this node to a Java long.asString()
Method that will return a valid String representation of the contained value, if the node is a value node (methodJsonNode.isValueNode()
returns true), otherwise empty String.tools.jackson.core.JsonToken
asToken()
Method that can be used for efficient type detection when using stream abstraction for traversing nodes.boolean
Method that will try to access value of this node as a Javaboolean
which works if (and only if) node contains JSON boolean value: if not, aJsonNodeException
will be thrown.boolean
booleanValue
(boolean defaultValue) Method similar toJsonNode.booleanValue()
, but that will return specifieddefaultValue
if this node does not contain a JSON boolean.Method similar toJsonNode.booleanValue()
, but that will returnOptional.empty()
if this node does not contain a JSON boolean.deepCopy()
All current value nodes are immutable, so we can just return them as is.boolean
Equality for node objects is defined as full (deep) value equality.static BooleanNode
getFalse()
Return the type of this nodestatic BooleanNode
getTrue()
int
hashCode()
protected Object
final void
serialize
(tools.jackson.core.JsonGenerator g, SerializationContext provider) Method called to serialize node instances using given generator.static BooleanNode
valueOf
(boolean b) Methods inherited from class tools.jackson.databind.node.ValueNode
_at, findParent, findParents, findValue, findValues, findValuesAsString, get, get, has, has, hasNonNull, hasNonNull, isEmpty, path, path, serializeWithType
Methods inherited from class tools.jackson.databind.node.BaseJsonNode
_jsonPointerIfValid, _reportBigIntegerCoercionFractionFail, _reportCoercionFail, _reportDoubleCoercionRangeFail, _reportFloatCoercionRangeFail, _reportIntCoercionFractionFail, _reportIntCoercionRangeFail, _reportLongCoercionFractionFail, _reportLongCoercionRangeFail, _reportShortCoercionFractionFail, _reportShortCoercionRangeFail, _reportWrongNodeType, _withArray, _withObject, _withXxxMayReplace, _withXxxVerifyReplace, asDecimal, asDecimal, asDouble, asInt, asLong, asString, bigIntegerValue, binaryValue, decimalValue, decimalValue, decimalValueOpt, doubleValue, doubleValue, doubleValueOpt, findPath, floatValue, intValue, intValue, intValueOpt, isEmbeddedValue, isMissingNode, longValue, longValue, longValueOpt, numberType, numberValue, required, required, shortValue, stringValue, stringValue, stringValueOpt, toPrettyString, toString, traverse, withArray, withObject
Methods inherited from class tools.jackson.databind.JsonNode
_reportRequiredViolation, _reportUnsupportedOperation, _this, asOptional, asText, asText, at, at, canConvertToExactIntegral, canConvertToInt, canConvertToLong, equals, findParents, findValues, findValuesAsString, forEachEntry, isArray, isBigDecimal, isBigInteger, isBinary, isBoolean, isContainer, isDouble, isFloat, isFloatingPointNumber, isInt, isIntegralNumber, isLong, isNull, isNumber, isObject, isPojo, isShort, isString, isTextual, isValueNode, iterator, optional, optional, properties, propertyNames, propertyStream, require, requiredAt, requiredAt, requireNonNull, size, spliterator, textValue, values, valueStream, withArray, withArray, withArray, withArrayProperty, withObject, withObject, withObject, withObjectProperty
Methods inherited from class tools.jackson.databind.JacksonSerializable.Base
isEmpty
-
Field Details
-
TRUE
-
FALSE
-
-
Constructor Details
-
BooleanNode
protected BooleanNode(boolean v)
-
-
Method Details
-
readResolve
-
getTrue
-
getFalse
-
valueOf
-
getNodeType
Description copied from class:JsonNode
Return the type of this node- Specified by:
getNodeType
in classJsonNode
- Returns:
- the node type as a
JsonNodeType
enum value
-
asToken
public tools.jackson.core.JsonToken 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) -
_valueDesc
Description copied from class:BaseJsonNode
Method for implementation classes to return a short description of contained value, to be used in error messages.- Specified by:
_valueDesc
in classBaseJsonNode
-
deepCopy
Description copied from class:ValueNode
All current value nodes are immutable, so we can just return them as is. -
booleanValue
public boolean booleanValue()Description copied from class:JsonNode
Method that will try to access value of this node as a Javaboolean
which works if (and only if) node contains JSON boolean value: if not, aJsonNodeException
will be thrown.NOTE: for more lenient conversions, use
JsonNode.asBoolean()
- Overrides:
booleanValue
in classBaseJsonNode
- Returns:
boolean
value this node represents (if JSON boolean)
-
booleanValue
public boolean booleanValue(boolean defaultValue) Description copied from class:JsonNode
Method similar toJsonNode.booleanValue()
, but that will return specifieddefaultValue
if this node does not contain a JSON boolean.- Overrides:
booleanValue
in classBaseJsonNode
- Parameters:
defaultValue
- Value to return if this node does not contain a JSON boolean.- Returns:
- Java
boolean
value this node represents (if JSON boolean);defaultValue
otherwise
-
booleanValueOpt
Description copied from class:JsonNode
Method similar toJsonNode.booleanValue()
, but that will returnOptional.empty()
if this node does not contain a JSON boolean.- Overrides:
booleanValueOpt
in classBaseJsonNode
- Returns:
Optional<Boolean>
value (if node represents JSON boolean);Optional.empty()
otherwise
-
asBoolean
public boolean asBoolean()Description copied from class:JsonNode
Method that will try to convert value of this node to a Java boolean. JSON booleans map naturally; integer numbers other than 0 map to true, and 0 maps to false and Strings 'true' and 'false' map to corresponding values.If representation cannot be converted to a boolean value (including structured types like Objects and Arrays), default value of false will be returned; no exceptions are thrown.
- Overrides:
asBoolean
in classBaseJsonNode
-
asBoolean
public boolean asBoolean(boolean defaultValue) Description copied from class:JsonNode
Method that will try to convert value of this node to a Java boolean. JSON booleans map naturally; integer numbers other than 0 map to true, and 0 maps to false and Strings 'true' and 'false' map to corresponding values.If representation cannot be converted to a boolean value (including structured types like Objects and Arrays), specified defaultValue will be returned; no exceptions are thrown.
- Overrides:
asBoolean
in classBaseJsonNode
-
asInt
public int asInt(int defaultValue) Description copied from class:JsonNode
Method that will try to convert value of this node to a Java int. Numbers are coerced using default Java rules; booleans convert to 0 (false) and 1 (true), and Strings are parsed using default Java language integer parsing rules.If representation cannot be converted to an int (including structured types like Objects and Arrays), specified defaultValue will be returned; no exceptions are thrown.
- Overrides:
asInt
in classBaseJsonNode
-
asLong
public long asLong(long defaultValue) Description copied from class:JsonNode
Method that will try to convert value of this node to a Java long. Numbers are coerced using default Java rules; booleans convert to 0 (false) and 1 (true), and Strings are parsed using default Java language integer parsing rules.If representation cannot be converted to a long (including structured types like Objects and Arrays), specified defaultValue will be returned; no exceptions are thrown.
- Overrides:
asLong
in classBaseJsonNode
-
asDouble
public double asDouble(double defaultValue) Description copied from class:JsonNode
Method that will try to convert value of this node to a Java double. Numbers are coerced using default Java rules; booleans convert to 0.0 (false) and 1.0 (true), and Strings are parsed using default Java language integer parsing rules.If representation cannot be converted to an int (including structured types like Objects and Arrays), specified defaultValue will be returned; no exceptions are thrown.
- Overrides:
asDouble
in classBaseJsonNode
-
asString
Description copied from class:JsonNode
Method that will return a valid String representation of the contained value, if the node is a value node (methodJsonNode.isValueNode()
returns true), otherwise empty String.NOTE: this is NOT same as
JsonNode.toString()
in that result isNOT VALID ENCODED JSON
for all nodes (but is for some, likeNumberNode
s andBooleanNode
s). -
serialize
public final void serialize(tools.jackson.core.JsonGenerator g, SerializationContext provider) throws tools.jackson.core.JacksonException Description copied from class:BaseJsonNode
Method called to serialize node instances using given generator.- Specified by:
serialize
in interfaceJacksonSerializable
- Specified by:
serialize
in classBaseJsonNode
- Throws:
tools.jackson.core.JacksonException
-
hashCode
public int hashCode()- Specified by:
hashCode
in classBaseJsonNode
-
equals
Description copied from class:JsonNode
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
Object
.
-