- All Implemented Interfaces:
Serializable,Iterable<JsonNode>,TreeNode,JacksonSerializable
Numeric node that contains simple 64-bit integer values.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.databind.JsonNode
JsonNode.OverwriteModeNested classes/interfaces inherited from interface tools.jackson.databind.JacksonSerializable
JacksonSerializable.Base -
Field Summary
FieldsFields inherited from class tools.jackson.databind.node.ValueNode
BD_MAX_INTEGER, BD_MAX_LONG, BD_MAX_SHORT, BD_MIN_INTEGER, BD_MIN_LONG, BD_MIN_SHORT, BI_MAX_INTEGER, BI_MAX_LONG, BI_MAX_SHORT, BI_MIN_INTEGER, BI_MIN_LONG, BI_MIN_SHORT, MISSINGFields inherited from class tools.jackson.databind.node.BaseJsonNode
OPT_FALSE, OPT_TRUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected BooleanMethod sub-classes should override if they can producebooleanvalues viaBaseJsonNode.asBoolean()-- if not, returnnull(in which case appropriate error will be thrown or default value returned).protected doubleprotected floatintMethod for sub-classes to implement; returns the underlying value as aintwithout any checks (wrt NaN or value range), so caller must ensure validity prior to callinglongMethod for sub-classes to implement; returns the underlying value as alongwithout any checks (wrt NaN or value range), so caller must ensure validity prior to callingshortMethod for sub-classes to implement; returns the underlying value as ashortwithout any checks (wrt NaN or value range), so caller must ensure validity prior to callingMethod sub-classes should override if they can produceStringvalues viaBaseJsonNode.asString()-- if not, returnnull(in which case appropriate error will be thrown or default value returned).doubleasDouble()Method similar toJsonNode.doubleValue()but in addition to coercing Number values will also try coerce couple of additional types: JSON String that represents JSON Numbers ("stringified" numbers) JSON Null (converted to0.0d) POJO nodes that contain Number valuesdoubleasDouble(double defaultValue) Method similar toJsonNode.asDouble(), but that will returndefaultValueif this node cannot be coerced todouble.Method similar toJsonNode.asDouble(), but that will return (OptionalDouble.empty()) if this node cannot be coerced todouble.floatasFloat()Method similar toJsonNode.floatValue()but in addition to coercing Number values will also try coerce couple of additional types: JSON String that represents JSON Numbers ("stringified" numbers) JSON Null (converted to0.0f) POJO nodes that contain Number valuesfloatasFloat(float defaultValue) Method similar toJsonNode.asFloat(), but that will returndefaultValueif this node cannot be coerced tofloat.Method similar toJsonNode.asFloat(), but that will return (Optional.empty()) if this node cannot be coerced tofloat.intasInt()Method similar toJsonNode.intValue()but in addition to coercing Number values (same asJsonNode.intValue()), will also try to coerce a couple of additional types (or cases): JSON Floating-point numbers with fractions (ones without fractions are ok forJsonNode.intValue()) will be truncated toint(if (and only if) they fit inintrange).intasInt(int defaultValue) Method similar toJsonNode.intValue(), but that will return specifieddefaultValueif this node cannot be converted toint.asIntOpt()Method similar toJsonNode.asInt(), but that will return (OptionalInt.empty()) if this node cannot be coerced toint.longasLong()Method similar toJsonNode.longValue()but in addition to coercing Number values (same asJsonNode.longValue()), will also try to coerce a couple of additional types (or cases): JSON Floating-point numbers with fractions (ones without fractions are ok forJsonNode.longValue()) will be truncated tolong(if (and only if) they fit inlongrange).longasLong(long defaultValue) Method similar toJsonNode.asLong(), but that will return specifieddefaultValueif this node cannot be coerced tolong(instead of throwing an exception).Method similar toJsonNode.asLong(), but that will return (OptionalLong.empty()) if this node cannot be coerced tolong.shortasShort()Method similar toJsonNode.shortValue()but in addition to coercing Number values (same asJsonNode.shortValue()), will also try to coerce a couple of additional types (or cases): JSON Floating-point numbers with fractions (ones without fractions are ok forJsonNode.shortValue()) will be truncated toshort(if (and only if) they fit inshortrange).shortasShort(short defaultValue) Method similar toJsonNode.shortValue(), but that will return specifieddefaultValueif this node cannot be converted toshort.Method similar toJsonNode.asShort(), but that will return (Optional.empty()) if this node cannot be coerced toshort.Method that will try to access value of this node as aBigInteger, but if node value cannot be expressed exactly as aBigInteger, aJsonNodeExceptionwill be thrown.bigIntegerValue(BigInteger defaultValue) Method similar toJsonNode.bigIntegerValue(), but that will return specifieddefaultValueif this node cannot be converted to JavaBigInteger.Method similar toJsonNode.bigIntegerValue(), but that will return empty (Optional.empty()) if this node cannot be converted to JavaBigInteger.Method that will try to access value of this node as a JavaBigDecimal: but if node value cannot be expressed exactly as aBigDecimal, aJsonNodeExceptionwill be thrown.decimalValue(BigDecimal defaultValue) Method similar toJsonNode.decimalValue(), but that will returndefaultValueif this node cannot be coerced to JavaBigDecimal.Method similar toJsonNode.decimalValue(), but that will return emptyOptional(Optional.empty()) if this node cannot be coerced toBigDecimal.doubleMethod that will try to access value of this node as adouble: but if node value cannot be expressed exactly as adouble, aJsonNodeExceptionwill be thrown.doubledoubleValue(double defaultValue) Method similar toJsonNode.doubleValue(), but that will return specifieddefaultValueif this node cannot be converted todouble.Method similar toJsonNode.doubleValue(), but that will return emptyOptionalLong(OptionalDouble.empty()) if this node cannot be converted to Javadouble.booleanEquality for node objects is defined as full (deep) value equality.floatMethod that will try to access value of this node as a Javafloat: but if node value cannot be expressed exactly as afloat, aJsonNodeExceptionwill be thrown.floatfloatValue(float defaultValue) Method similar toJsonNode.floatValue(), but that will return specifieddefaultValueif this node cannot be converted tofloat.Method similar toJsonNode.floatValue(), but that will return emptyOptional<Float>(Optional.empty()) if this node cannot be converted to Javafloat.inthashCode()booleanMethod that can be used to determine whether this numeric value's in part fits within Java 32-bitinttype.booleanMethod that can be used to determine whether this numeric value's in part fits within Java 64-bitlongtype.booleanMethod that can be used to determine whether this numeric value's in part fits within Java 16-bitshorttype.intintValue()Method that will try to access value of this node as a Javaint: but if node value cannot be expressed exactly as anint, aJsonNodeExceptionwill be thrown.intintValue(int defaultValue) Method similar toJsonNode.intValue(), but that will return specifieddefaultValueif this node cannot be converted to Javaint.Method similar toJsonNode.intValue(), but that will return emptyOptionalInt(OptionalInt.empty()) if this node cannot be converted to Javaint.booleanlongMethod that will try to access value of this node as a Javalong: but if node value cannot be expressed exactly as along, aJsonNodeExceptionwill be thrown.longlongValue(long defaultValue) Method similar toJsonNode.longValue(), but that will return specifieddefaultValueif this node cannot be converted tolong.Method similar toJsonNode.longValue(), but that will return emptyOptionalLong(OptionalLong.empty()) if this node cannot be converted to Javalong.Returns code that identifies type of underlying numeric value, if (and only if) node is a number node.Method that will try to access value of this node asNumberthat accurately represents its value, if (and only if) this is a number node (returnstrueforJsonNode.isNumber()).final voidserialize(JsonGenerator g, SerializationContext provider) Method called to serialize node instances using given generator.shortMethod that will try to access value of this node as 16-bit signed integer value (Javashort): but if node value cannot be expressed exactly as ashort, aJsonNodeExceptionwill be thrown.shortshortValue(short defaultValue) Method similar toJsonNode.shortValue(), but that will return specifieddefaultValueif this node cannot be converted to Javashort.Method similar toJsonNode.shortValue(), but that will return emptyOptional<Short>(Optional.empty()) if this node cannot be converted to Javashort.static BigIntegerNodeMethods inherited from class tools.jackson.databind.node.NumericIntNode
asBigInteger, asBigInteger, asBigIntegerOpt, asDecimal, asDecimal, asDecimalOpt, asToken, canConvertToInt, canConvertToLong, canConvertToShort, hasFractionalPart, isIntegralNumber, isNaNMethods inherited from class tools.jackson.databind.node.NumericNode
_valueDesc, deepCopy, getNodeTypeMethods inherited from class tools.jackson.databind.node.ValueNode
_at, findParent, findParents, findValue, findValues, findValuesAsString, get, get, has, has, hasNonNull, hasNonNull, isEmpty, path, path, serializeWithTypeMethods inherited from class tools.jackson.databind.node.BaseJsonNode
_jsonPointerIfValid, _reportBigDecimalCoercionNaNFail, _reportBigIntegerCoercionFractionFail, _reportBigIntegerCoercionNaNFail, _reportCoercionFail, _reportDoubleCoercionRangeFail, _reportFloatCoercionRangeFail, _reportIntCoercionFractionFail, _reportIntCoercionNaNFail, _reportIntCoercionRangeFail, _reportLongCoercionFractionFail, _reportLongCoercionNaNFail, _reportLongCoercionRangeFail, _reportShortCoercionFractionFail, _reportShortCoercionRangeFail, _reportWrongNodeType, _withArray, _withObject, _withXxxMayReplace, _withXxxVerifyReplace, asBoolean, asBoolean, asBooleanOpt, asString, asString, asStringOpt, binaryValue, booleanValue, booleanValue, booleanValueOpt, findPath, isEmbeddedValue, isMissingNode, required, required, stringValue, stringValue, stringValueOpt, toPrettyString, toString, traverse, withArray, withObjectMethods inherited from class tools.jackson.databind.JsonNode
_reportRequiredViolation, _reportUnsupportedOperation, _this, asOptional, asText, asText, at, at, canConvertToExactIntegral, equals, findParents, findValues, findValuesAsString, forEachEntry, isArray, isBigDecimal, isBinary, isBoolean, isContainer, isDouble, isFloat, isFloatingPointNumber, isInt, 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, withObjectPropertyMethods inherited from class tools.jackson.databind.JacksonSerializable.Base
isEmpty
-
Field Details
-
_value
-
-
Constructor Details
-
BigIntegerNode
-
-
Method Details
-
valueOf
-
numberType
Description copied from class:BaseJsonNodeReturns code that identifies type of underlying numeric value, if (and only if) node is a number node.- Specified by:
numberTypein interfaceTreeNode- Specified by:
numberTypein classNumericNode
-
isBigInteger
public boolean isBigInteger()- Overrides:
isBigIntegerin classJsonNode
-
_asBoolean
Description copied from class:BaseJsonNodeMethod sub-classes should override if they can producebooleanvalues viaBaseJsonNode.asBoolean()-- if not, returnnull(in which case appropriate error will be thrown or default value returned).- Overrides:
_asBooleanin classBaseJsonNode- Returns:
- Coerced value if possible; otherwise
nullto indicate this node cannot be coerced.
-
_asString
Description copied from class:BaseJsonNodeMethod sub-classes should override if they can produceStringvalues viaBaseJsonNode.asString()-- if not, returnnull(in which case appropriate error will be thrown or default value returned).- Specified by:
_asStringin classNumericNode- Returns:
- Coerced value if possible; otherwise
nullto indicate this node cannot be coerced.
-
numberValue
Description copied from class:JsonNodeMethod that will try to access value of this node asNumberthat accurately represents its value, if (and only if) this is a number node (returnstrueforJsonNode.isNumber()). If this node is NOT a number node, aJsonNodeExceptionwill be thrown.- Specified by:
numberValuein classNumericNode- Returns:
- Number value this node contains, if numeric node
-
shortValue
public short shortValue()Description copied from class:JsonNodeMethod that will try to access value of this node as 16-bit signed integer value (Javashort): but if node value cannot be expressed exactly as ashort, aJsonNodeExceptionwill be thrown. Access works for following cases:- JSON Integer values that fit in Java 16-bit signed
shortrange - JSON Floating-point values that fit in Java 16-bit signed
shortrange AND do not have fractional part.
- Specified by:
shortValuein classNumericNode- Returns:
Shortvalue this node represents, if possible to accurately represent
- JSON Integer values that fit in Java 16-bit signed
-
shortValue
public short shortValue(short defaultValue) Description copied from class:JsonNodeMethod similar toJsonNode.shortValue(), but that will return specifieddefaultValueif this node cannot be converted to Javashort.- Specified by:
shortValuein classNumericNode- Parameters:
defaultValue- Value to return if this node cannot be converted to Javashort- Returns:
- Java
shortvalue this node represents, if possible to accurately represent;defaultValueotherwise
-
shortValueOpt
Description copied from class:JsonNodeMethod similar toJsonNode.shortValue(), but that will return emptyOptional<Short>(Optional.empty()) if this node cannot be converted to Javashort.- Specified by:
shortValueOptin classNumericNode- Returns:
- Java
shortvalue this node represents, asOptional<Short>, if possible to accurately represent;Optional.empty()otherwise
-
asShort
public short asShort()Description copied from class:JsonNodeMethod similar toJsonNode.shortValue()but in addition to coercing Number values (same asJsonNode.shortValue()), will also try to coerce a couple of additional types (or cases):- JSON Floating-point numbers with fractions (ones without fractions
are ok for
JsonNode.shortValue()) will be truncated toshort(if (and only if) they fit inshortrange). - JSON Strings that represent JSON Numbers ("stringified" numbers)
- JSON Null (converted to
0)) - POJO nodes that contain Number values
- Specified by:
asShortin classNumericNode- Returns:
shortvalue this node represents, if possible to accurately represent
- JSON Floating-point numbers with fractions (ones without fractions
are ok for
-
asShort
public short asShort(short defaultValue) Description copied from class:JsonNodeMethod similar toJsonNode.shortValue(), but that will return specifieddefaultValueif this node cannot be converted toshort.- Specified by:
asShortin classNumericNode- Parameters:
defaultValue- Value to return if this node cannot be converted toshort- Returns:
shortvalue this node represents, if possible to accurately represent;defaultValueotherwise
-
asShortOpt
Description copied from class:JsonNodeMethod similar toJsonNode.asShort(), but that will return (Optional.empty()) if this node cannot be coerced toshort.- Specified by:
asShortOptin classNumericNode- Returns:
Optional<Short>value this node represents, if possible to accurately represent;Optional.empty()otherwise
-
intValue
public int intValue()Description copied from class:JsonNodeMethod that will try to access value of this node as a Javaint: but if node value cannot be expressed exactly as anint, aJsonNodeExceptionwill be thrown. Access works for following cases:- JSON Integer values that fit in Java 32-bit signed
intrange - JSON Floating-point values that fit in Java 32-bit signed
intrange AND do not have fractional part.
NOTE: for more lenient conversions, use
JsonNode.asInt()- Specified by:
intValuein classNumericNode- Returns:
Intvalue this node represents, if possible to accurately represent
- JSON Integer values that fit in Java 32-bit signed
-
intValue
public int intValue(int defaultValue) Description copied from class:JsonNodeMethod similar toJsonNode.intValue(), but that will return specifieddefaultValueif this node cannot be converted to Javaint.- Specified by:
intValuein classNumericNode- Parameters:
defaultValue- Value to return if this node cannot be converted to Javaint- Returns:
- Java
intvalue this node represents, if possible to accurately represent;defaultValueotherwise
-
intValueOpt
Description copied from class:JsonNodeMethod similar toJsonNode.intValue(), but that will return emptyOptionalInt(OptionalInt.empty()) if this node cannot be converted to Javaint.- Specified by:
intValueOptin classNumericNode- Returns:
- Java
intvalue this node represents, asOptionalInt, if possible to accurately represent;OptionalInt.empty()otherwise
-
asInt
public int asInt()Description copied from class:JsonNodeMethod similar toJsonNode.intValue()but in addition to coercing Number values (same asJsonNode.intValue()), will also try to coerce a couple of additional types (or cases):- JSON Floating-point numbers with fractions (ones without fractions
are ok for
JsonNode.intValue()) will be truncated toint(if (and only if) they fit inintrange). - JSON Strings that represent JSON Numbers ("stringified" numbers)
- JSON Null (converted to
0)) - POJO nodes that contain Number values
- Specified by:
asIntin classNumericNode- Returns:
intvalue this node represents, if possible to accurately represent
- JSON Floating-point numbers with fractions (ones without fractions
are ok for
-
asInt
public int asInt(int defaultValue) Description copied from class:JsonNodeMethod similar toJsonNode.intValue(), but that will return specifieddefaultValueif this node cannot be converted toint.- Specified by:
asIntin classNumericNode- Parameters:
defaultValue- Value to return if this node cannot be converted toint- Returns:
intvalue this node represents, if possible to accurately represent;defaultValueotherwise
-
asIntOpt
Description copied from class:JsonNodeMethod similar toJsonNode.asInt(), but that will return (OptionalInt.empty()) if this node cannot be coerced toint.- Specified by:
asIntOptin classNumericNode- Returns:
OptionalIntvalue this node represents, if possible to accurately represent;OptionalInt.empty()otherwise
-
longValue
public long longValue()Description copied from class:JsonNodeMethod that will try to access value of this node as a Javalong: but if node value cannot be expressed exactly as along, aJsonNodeExceptionwill be thrown. Access works for following cases:- JSON Integer values that fit in Java 64-bit signed
longrange - JSON Floating-point values that fit in Java 64-bit signed
longrange AND do not have fractional part.
NOTE: for more lenient conversions, use
JsonNode.asLong()- Specified by:
longValuein classNumericNode- Returns:
Longvalue this node represents, if possible to accurately represent
- JSON Integer values that fit in Java 64-bit signed
-
longValue
public long longValue(long defaultValue) Description copied from class:JsonNodeMethod similar toJsonNode.longValue(), but that will return specifieddefaultValueif this node cannot be converted tolong.- Specified by:
longValuein classNumericNode- Parameters:
defaultValue- Value to return if this node cannot be converted tolong- Returns:
longvalue this node represents, if possible to accurately represent;defaultValueotherwise
-
longValueOpt
Description copied from class:JsonNodeMethod similar toJsonNode.longValue(), but that will return emptyOptionalLong(OptionalLong.empty()) if this node cannot be converted to Javalong.- Specified by:
longValueOptin classNumericNode- Returns:
- Java
longvalue this node represents, asOptionalLong, if possible to accurately represent;OptionalLong.empty()otherwise
-
asLong
public long asLong()Description copied from class:JsonNodeMethod similar toJsonNode.longValue()but in addition to coercing Number values (same asJsonNode.longValue()), will also try to coerce a couple of additional types (or cases):- JSON Floating-point numbers with fractions (ones without fractions
are ok for
JsonNode.longValue()) will be truncated tolong(if (and only if) they fit inlongrange). - JSON Strings that represent JSON Numbers ("stringified" numbers)
- JSON Null (converted to
0)) - POJO nodes that contain Number values
- Specified by:
asLongin classNumericNode- Returns:
longvalue this node represents, if possible to accurately represent
- JSON Floating-point numbers with fractions (ones without fractions
are ok for
-
asLong
public long asLong(long defaultValue) Description copied from class:JsonNodeMethod similar toJsonNode.asLong(), but that will return specifieddefaultValueif this node cannot be coerced tolong(instead of throwing an exception).- Specified by:
asLongin classNumericNode- Parameters:
defaultValue- Value to return if this node cannot be coerced tolong- Returns:
longvalue this node represents, if possible to accurately represent;defaultValueotherwise
-
asLongOpt
Description copied from class:JsonNodeMethod similar toJsonNode.asLong(), but that will return (OptionalLong.empty()) if this node cannot be coerced tolong.- Specified by:
asLongOptin classNumericNode- Returns:
OptionalLongvalue this node represents (or can be coerced to),OptionalLong.empty()otherwise
-
bigIntegerValue
Description copied from class:JsonNodeMethod that will try to access value of this node as aBigInteger, but if node value cannot be expressed exactly as aBigInteger, aJsonNodeExceptionwill be thrown. Access works for following cases:- JSON Integer values
- JSON Floating-point values that do not have fractional part.
- Specified by:
bigIntegerValuein classNumericIntNode- Returns:
BigIntegervalue this node represents, if possible to accurately represent
-
bigIntegerValue
Description copied from class:JsonNodeMethod similar toJsonNode.bigIntegerValue(), but that will return specifieddefaultValueif this node cannot be converted to JavaBigInteger.- Overrides:
bigIntegerValuein classNumericIntNode- Parameters:
defaultValue- Value to return if this node cannot be converted to JavaBigInteger- Returns:
- Java
BigIntegervalue this node represents, if possible to accurately represent;defaultValueotherwise
-
bigIntegerValueOpt
Description copied from class:JsonNodeMethod similar toJsonNode.bigIntegerValue(), but that will return empty (Optional.empty()) if this node cannot be converted to JavaBigInteger.- Overrides:
bigIntegerValueOptin classNumericIntNode- Returns:
- Java
BigIntegervalue this node represents, asOptional<BigInteger>, if possible to accurately represent;Optional.empty()otherwise
-
floatValue
public float floatValue()Description copied from class:JsonNodeMethod that will try to access value of this node as a Javafloat: but if node value cannot be expressed exactly as afloat, aJsonNodeExceptionwill be thrown. Access works for following cases:- JSON Floating-point values that fit in Java 32-bit
doublerange - JSON Integer values that fit in Java 32-bit
doublerange
- Overrides:
floatValuein classNumericIntNode- Returns:
Floatvalue this node represents, if possible to accurately represent
- JSON Floating-point values that fit in Java 32-bit
-
floatValue
public float floatValue(float defaultValue) Description copied from class:JsonNodeMethod similar toJsonNode.floatValue(), but that will return specifieddefaultValueif this node cannot be converted tofloat.- Overrides:
floatValuein classNumericIntNode- Parameters:
defaultValue- Value to return if this node cannot be converted tofloat- Returns:
floatvalue this node represents, if possible to accurately represent;defaultValueotherwise
-
floatValueOpt
Description copied from class:JsonNodeMethod similar toJsonNode.floatValue(), but that will return emptyOptional<Float>(Optional.empty()) if this node cannot be converted to Javafloat.- Overrides:
floatValueOptin classNumericIntNode- Returns:
- Java
floatvalue this node represents, asOptional<Float>, if possible to accurately represent;Optional.empty()otherwise
-
asFloat
public float asFloat()Description copied from class:JsonNodeMethod similar toJsonNode.floatValue()but in addition to coercing Number values will also try coerce couple of additional types:- JSON String that represents JSON Numbers ("stringified" numbers)
- JSON Null (converted to
0.0f) - POJO nodes that contain Number values
- Overrides:
asFloatin classNumericIntNode- Returns:
floatvalue this node represents, if possible to accurately represent
-
asFloat
public float asFloat(float defaultValue) Description copied from class:JsonNodeMethod similar toJsonNode.asFloat(), but that will returndefaultValueif this node cannot be coerced tofloat.- Overrides:
asFloatin classNumericIntNode- Returns:
floatvalue this node represents, if possible to accurately represent;defaultValueotherwise
-
asFloatOpt
Description copied from class:JsonNodeMethod similar toJsonNode.asFloat(), but that will return (Optional.empty()) if this node cannot be coerced tofloat.- Overrides:
asFloatOptin classNumericIntNode- Returns:
Optional<Float>value this node represents, if possible to accurately represent;Optional.empty()otherwise
-
doubleValue
public double doubleValue()Description copied from class:JsonNodeMethod that will try to access value of this node as adouble: but if node value cannot be expressed exactly as adouble, aJsonNodeExceptionwill be thrown. Access works for following cases:- JSON Floating-point values that fit in Java 64-bit
doublerange - JSON Integer values that fit in Java 64-bit
doublerange
NOTE: for more lenient conversions, use
JsonNode.asDouble()- Overrides:
doubleValuein classNumericIntNode- Returns:
Doublevalue this node represents, if possible to accurately represent
- JSON Floating-point values that fit in Java 64-bit
-
doubleValue
public double doubleValue(double defaultValue) Description copied from class:JsonNodeMethod similar toJsonNode.doubleValue(), but that will return specifieddefaultValueif this node cannot be converted todouble.- Overrides:
doubleValuein classNumericIntNode- Parameters:
defaultValue- Value to return if this node cannot be converted todouble- Returns:
doublevalue this node represents, if possible to accurately represent;defaultValueotherwise
-
doubleValueOpt
Description copied from class:JsonNodeMethod similar toJsonNode.doubleValue(), but that will return emptyOptionalLong(OptionalDouble.empty()) if this node cannot be converted to Javadouble.- Overrides:
doubleValueOptin classNumericIntNode- Returns:
- Java
doublevalue this node represents, asOptionalDouble, if possible to accurately represent;OptionalDouble.empty()otherwise
-
asDouble
public double asDouble()Description copied from class:JsonNodeMethod similar toJsonNode.doubleValue()but in addition to coercing Number values will also try coerce couple of additional types:- JSON String that represents JSON Numbers ("stringified" numbers)
- JSON Null (converted to
0.0d) - POJO nodes that contain Number values
- Overrides:
asDoublein classNumericIntNode- Returns:
doublevalue this node represents, if possible to accurately represent
-
asDouble
public double asDouble(double defaultValue) Description copied from class:JsonNodeMethod similar toJsonNode.asDouble(), but that will returndefaultValueif this node cannot be coerced todouble.- Overrides:
asDoublein classNumericIntNode- Returns:
doublevalue this node represents, if possible to accurately represent;defaultValueotherwise
-
asDoubleOpt
Description copied from class:JsonNodeMethod similar toJsonNode.asDouble(), but that will return (OptionalDouble.empty()) if this node cannot be coerced todouble.- Overrides:
asDoubleOptin classNumericIntNode- Returns:
OptionalDoublevalue this node represents, if possible to accurately represent;OptionalDouble.empty()otherwise
-
decimalValue
Description copied from class:JsonNodeMethod that will try to access value of this node as a JavaBigDecimal: but if node value cannot be expressed exactly as aBigDecimal, aJsonNodeExceptionwill be thrown. Access works for following cases:- All JSON Number values
NOTE: for more lenient conversions, use
JsonNode.asDecimal()- Specified by:
decimalValuein classNumericNode- Returns:
BigDecimalvalue this node represents, if possible to accurately represent
-
decimalValue
Description copied from class:JsonNodeMethod similar toJsonNode.decimalValue(), but that will returndefaultValueif this node cannot be coerced to JavaBigDecimal.- Overrides:
decimalValuein classNumericIntNode- Returns:
BigDecimalvalue this node represents, if possible to accurately represent;defaultValueotherwise
-
decimalValueOpt
Description copied from class:JsonNodeMethod similar toJsonNode.decimalValue(), but that will return emptyOptional(Optional.empty()) if this node cannot be coerced toBigDecimal.- Overrides:
decimalValueOptin classNumericIntNode- Returns:
- Java
BigDecimalvalue this node represents, asOptional<BigDecimal>, if possible to accurately represent;Optional.empty()otherwise
-
_asShortValueUnchecked
public short _asShortValueUnchecked()Description copied from class:NumericNodeMethod for sub-classes to implement; returns the underlying value as ashortwithout any checks (wrt NaN or value range), so caller must ensure validity prior to calling- Specified by:
_asShortValueUncheckedin classNumericNode
-
_asIntValueUnchecked
public int _asIntValueUnchecked()Description copied from class:NumericNodeMethod for sub-classes to implement; returns the underlying value as aintwithout any checks (wrt NaN or value range), so caller must ensure validity prior to calling- Specified by:
_asIntValueUncheckedin classNumericNode
-
_asLongValueUnchecked
public long _asLongValueUnchecked()Description copied from class:NumericNodeMethod for sub-classes to implement; returns the underlying value as alongwithout any checks (wrt NaN or value range), so caller must ensure validity prior to calling- Specified by:
_asLongValueUncheckedin classNumericNode
-
_asFloatValueUnchecked
protected float _asFloatValueUnchecked()- Specified by:
_asFloatValueUncheckedin classNumericIntNode
-
_asDoubleValueUnchecked
protected double _asDoubleValueUnchecked()- Specified by:
_asDoubleValueUncheckedin classNumericIntNode
-
inShortRange
public boolean inShortRange()Description copied from class:NumericNodeMethod that can be used to determine whether this numeric value's in part fits within Java 16-bitshorttype.- Specified by:
inShortRangein classNumericNode
-
inIntRange
public boolean inIntRange()Description copied from class:NumericNodeMethod that can be used to determine whether this numeric value's in part fits within Java 32-bitinttype.- Specified by:
inIntRangein classNumericNode
-
inLongRange
public boolean inLongRange()Description copied from class:NumericNodeMethod that can be used to determine whether this numeric value's in part fits within Java 64-bitlongtype.- Specified by:
inLongRangein classNumericNode
-
serialize
Description copied from class:BaseJsonNodeMethod called to serialize node instances using given generator.- Specified by:
serializein interfaceJacksonSerializable- Specified by:
serializein classBaseJsonNode- Throws:
JacksonException
-
equals
Description copied from class:JsonNodeEquality 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. -
hashCode
public int hashCode()- Specified by:
hashCodein classBaseJsonNode
-