- All Implemented Interfaces:
Serializable,Iterable<JsonNode>,TreeNode,JacksonSerializable
- Direct Known Subclasses:
DecimalNode,DoubleNode,FloatNode
- 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
Fields 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 abstract BigIntegerMethod for sub-classes to implement; returns the underlying value as aBigIntegerwithout any checks (wrt NaN), so caller must ensure validity prior to callingprotected abstract BigDecimalMethod for sub-classes to implement; returns the underlying value as aBigDecimalwithout any checks (wrt NaN), so caller must ensure validity prior to callingprotected abstract intMethod 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 callingprotected abstract longMethod 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 callingprotected abstract shortMethod 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 callingprotected abstract booleanprotected abstract booleanprotected abstract booleanprotected abstract booleanfinal BigIntegerMethod similar toJsonNode.bigIntegerValue()but in addition to coercing Number values (same asJsonNode.bigIntegerValue()), will also try to coerce a couple of additional types (or cases): JSON Floating-point numbers with fractions (ones without fractions are ok forJsonNode.bigIntegerValue()) will be truncated to integer value (like withBigDecimal.toBigInteger())) JSON Strings that represent JSON Numbers ("stringified" numbers) JSON Null (converted to0)) POJO nodes that contain Number valuesfinal BigIntegerasBigInteger(BigInteger defaultValue) Method similar toJsonNode.asBigInteger(), but that will return specifieddefaultValueif this node cannot be converted toBigInteger.final Optional<BigInteger>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 aBigDecimal: but if node value cannot be expressed exactly as aBigDecimal, aJsonNodeExceptionwill be thrown.asDecimal(BigDecimal defaultValue) Method similar toJsonNode.asDecimal(), but that will returndefaultValueif this node cannot be coerced to JavaBigDecimal.Method similar toJsonNode.asDecimal(), but that will return emptyOptional(Optional.empty()) if this node cannot be coerced toBigDecimal.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.final 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).final longasLong(long defaultValue) Method similar toJsonNode.asLong(), but that will return specifieddefaultValueif this node cannot be coerced tolong(instead of throwing an exception).final OptionalLongMethod 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.final JsonTokenasToken()Method that can be used for efficient type detection when using stream abstraction for traversing nodes.final BigIntegerMethod that will try to access value of this node as aBigInteger, but if node value cannot be expressed exactly as aBigInteger, aJsonNodeExceptionwill be thrown.final BigIntegerbigIntegerValue(BigInteger defaultValue) Method similar toJsonNode.bigIntegerValue(), but that will return specifieddefaultValueif this node cannot be converted to JavaBigInteger.final Optional<BigInteger>Method similar toJsonNode.bigIntegerValue(), but that will return empty (Optional.empty()) if this node cannot be converted to JavaBigInteger.final booleanMethod that can be used to check whether contained value is numeric (returns true forJsonNode.isNumber()) and can be converted without loss to integral number (specifically,BigIntegerbut potentially others, seeJsonNode.canConvertToInt()andJsonNode.canConvertToInt()).final booleanMethod that can be used to check whether this node is a numeric node (JsonNode.isNumber()would return true) AND can be converted without loss toint(that is, its value fits in Java's 32-bit signed integer type,intand if it is a floating-point number, it does not have fractional part).final booleanMethod that can be used to check whether this node is a numeric node (JsonNode.isNumber()would return true) AND can be converted without loss tolong(that is, its value fits in Java's 64-bit signed integer type,longand if it is a floating-point number, it does not have fractional part).final booleanMethod that can be used to check whether this node is a numeric node (JsonNode.isNumber()would return true) AND can be converted without loss toshort(that is, its value fits in Java's 16-bit signed integer type,shortand if it is a floating-point number, it does not have fractional part).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.final 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.final intintValue(int defaultValue) Method similar toJsonNode.intValue(), but that will return specifieddefaultValueif this node cannot be converted to Javaint.final OptionalIntMethod similar toJsonNode.intValue(), but that will return emptyOptionalInt(OptionalInt.empty()) if this node cannot be converted to Javaint.final booleanfinal longMethod 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.final longlongValue(long defaultValue) Method similar toJsonNode.longValue(), but that will return specifieddefaultValueif this node cannot be converted tolong.final OptionalLongMethod similar toJsonNode.longValue(), but that will return emptyOptionalLong(OptionalLong.empty()) if this node cannot be converted to Javalong.final 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.final 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.Methods inherited from class tools.jackson.databind.node.NumericNode
_asString, _valueDesc, asDouble, asDouble, asDoubleOpt, asFloat, asFloat, asFloatOpt, deepCopy, doubleValue, doubleValue, doubleValueOpt, floatValue, floatValue, floatValueOpt, getNodeType, isNaN, numberType, numberValueMethods 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
_asBoolean, _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, hashCode, isEmbeddedValue, isMissingNode, required, required, serialize, stringValue, stringValue, stringValueOpt, toPrettyString, toString, traverse, withArray, withObjectMethods inherited from class tools.jackson.databind.JsonNode
_reportRequiredViolation, _reportUnsupportedOperation, _this, asOptional, asText, asText, at, at, equals, equals, findParents, findValues, findValuesAsString, forEachEntry, isArray, isBigDecimal, isBigInteger, isBinary, isBoolean, isContainer, isDouble, isFloat, 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, withObjectPropertyMethods inherited from class tools.jackson.databind.JacksonSerializable.Base
isEmpty
-
Constructor Details
-
NumericFPNode
public NumericFPNode()
-
-
Method Details
-
asToken
Description copied from class:BaseJsonNodeMethod that can be used for efficient type detection when using stream abstraction for traversing nodes. Will return the firstJsonTokenthat equivalent stream event would produce (for most nodes there is just one token but for structured/container types multiple) -
isFloatingPointNumber
public final boolean isFloatingPointNumber()- Overrides:
isFloatingPointNumberin classJsonNode- Returns:
- True if this node represents a non-integral numeric JSON value
-
canConvertToShort
public final boolean canConvertToShort()Description copied from class:JsonNodeMethod that can be used to check whether this node is a numeric node (JsonNode.isNumber()would return true) AND can be converted without loss toshort(that is, its value fits in Java's 16-bit signed integer type,shortand if it is a floating-point number, it does not have fractional part).NOTE: this method does not consider possible value type conversion from non-number types like JSON String into Number; so even if this method returns false, it is possible that
JsonNode.asShort()could still succeed.- Specified by:
canConvertToShortin classNumericNode
-
canConvertToInt
public final boolean canConvertToInt()Description copied from class:JsonNodeMethod that can be used to check whether this node is a numeric node (JsonNode.isNumber()would return true) AND can be converted without loss toint(that is, its value fits in Java's 32-bit signed integer type,intand if it is a floating-point number, it does not have fractional part).NOTE: this method does not consider possible value type conversion from non-number types like JSON String into Number; so even if this method returns false, it is possible that
JsonNode.asInt()could still succeed.- Specified by:
canConvertToIntin classNumericNode
-
canConvertToLong
public final boolean canConvertToLong()Description copied from class:JsonNodeMethod that can be used to check whether this node is a numeric node (JsonNode.isNumber()would return true) AND can be converted without loss tolong(that is, its value fits in Java's 64-bit signed integer type,longand if it is a floating-point number, it does not have fractional part).NOTE: this method does not consider possible value type conversion from non-number types like JSON String into Number; so even if this method returns false, it is possible that
JsonNode.asLong()could still succeed.- Specified by:
canConvertToLongin classNumericNode
-
canConvertToExactIntegral
public final boolean canConvertToExactIntegral()Description copied from class:JsonNodeMethod that can be used to check whether contained value is numeric (returns true forJsonNode.isNumber()) and can be converted without loss to integral number (specifically,BigIntegerbut potentially others, seeJsonNode.canConvertToInt()andJsonNode.canConvertToInt()). Latter part allows floating-point numbers (for whichJsonNode.isFloatingPointNumber()returnstrue) that do not have fractional part. Note that "not-a-number" values ofdoubleandfloatwill returnfalseas they cannot be converted to matching integral representations.- Overrides:
canConvertToExactIntegralin classJsonNode- Returns:
- True if the value is an actual number with no fractional part; false for non-numeric types, NaN representations of floating-point numbers, and floating-point numbers with fractional part.
-
shortValue
public final 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 final 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 final 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 final 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 final 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 final 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 final 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 final 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 classNumericNode- 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.- Specified by:
bigIntegerValuein classNumericNode- 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.- Specified by:
bigIntegerValueOptin classNumericNode- Returns:
- Java
BigIntegervalue this node represents, asOptional<BigInteger>, if possible to accurately represent;Optional.empty()otherwise
-
asBigInteger
Description copied from class:JsonNodeMethod similar toJsonNode.bigIntegerValue()but in addition to coercing Number values (same asJsonNode.bigIntegerValue()), 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.bigIntegerValue()) will be truncated to integer value (like withBigDecimal.toBigInteger())) - JSON Strings that represent JSON Numbers ("stringified" numbers)
- JSON Null (converted to
0)) - POJO nodes that contain Number values
- Specified by:
asBigIntegerin classNumericNode- Returns:
BigIntegervalue this node represents, if possible to accurately convert;defaultValueotherwise
- JSON Floating-point numbers with fractions (ones without fractions
are ok for
-
asBigInteger
Description copied from class:JsonNodeMethod similar toJsonNode.asBigInteger(), but that will return specifieddefaultValueif this node cannot be converted toBigInteger.- Specified by:
asBigIntegerin classNumericNode- Parameters:
defaultValue- Value to return if this node cannot be converted toBigInteger- Returns:
BigIntegervalue this node represents, if possible to accurately convert;defaultValueotherwise
-
asBigIntegerOpt
Description copied from class:JsonNodeMethod similar toJsonNode.bigIntegerValue(), but that will return empty (Optional.empty()) if this node cannot be converted to JavaBigInteger.- Specified by:
asBigIntegerOptin classNumericNode- Returns:
BigIntegervalue this node represents, asOptional<BigInteger>, if possible to accurately represent;Optional.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.- Specified by:
decimalValuein classNumericNode- 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.- Specified by:
decimalValueOptin classNumericNode- Returns:
- Java
BigDecimalvalue this node represents, asOptional<BigDecimal>, if possible to accurately represent;Optional.empty()otherwise
-
asDecimal
Description copied from class:JsonNodeMethod that will try to access value of this node as aBigDecimal: but if node value cannot be expressed exactly as aBigDecimal, aJsonNodeExceptionwill be thrown. Access works for following cases:- JSON Floating-point values (but not "NaN" or "Infinity")
- JSON Integer values
- JSON String that represents JSON Numbers ("stringified" numbers)
- JSON Null (converted to
BigDecimal.ZERO)) - POJO nodes that contain Number values
- Specified by:
asDecimalin classNumericNode- Returns:
BigDecimalvalue this node represents, if possible to accurately represent
-
asDecimal
Description copied from class:JsonNodeMethod similar toJsonNode.asDecimal(), but that will returndefaultValueif this node cannot be coerced to JavaBigDecimal.- Specified by:
asDecimalin classNumericNode- Returns:
BigDecimalvalue this node represents, if possible to accurately represent;defaultValueotherwise
-
asDecimalOpt
Description copied from class:JsonNodeMethod similar toJsonNode.asDecimal(), but that will return emptyOptional(Optional.empty()) if this node cannot be coerced toBigDecimal.- Specified by:
asDecimalOptin classNumericNode- Returns:
- Java
BigDecimalvalue this node represents, asOptional<BigDecimal>, if possible to accurately represent;Optional.empty()otherwise
-
_asShortValueUnchecked
protected abstract short _asShortValueUnchecked()Method 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 -
_asIntValueUnchecked
protected abstract int _asIntValueUnchecked()Method 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 -
_asLongValueUnchecked
protected abstract long _asLongValueUnchecked()Method 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 -
_asBigIntegerValueUnchecked
Method for sub-classes to implement; returns the underlying value as aBigIntegerwithout any checks (wrt NaN), so caller must ensure validity prior to calling -
_asDecimalValueUnchecked
Method for sub-classes to implement; returns the underlying value as aBigDecimalwithout any checks (wrt NaN), so caller must ensure validity prior to calling -
_hasFractionalPart
protected abstract boolean _hasFractionalPart() -
_inShortRange
protected abstract boolean _inShortRange() -
_inIntRange
protected abstract boolean _inIntRange() -
_inLongRange
protected abstract boolean _inLongRange()
-