- 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.OverwriteMode
Nested classes/interfaces inherited from interface tools.jackson.databind.JacksonSerializable
JacksonSerializable.Base
-
Field Summary
FieldsFields inherited from class tools.jackson.databind.node.BaseJsonNode
OPT_FALSE, OPT_TRUE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Boolean
Method sub-classes should override if they can produceboolean
values viaBaseJsonNode.asBoolean()
-- if not, returnnull
(in which case appropriate error will be thrown or default value returned).protected double
protected float
protected int
Method sub-classes should override if they can produceString
values viaBaseJsonNode.asString()
-- if not, returnnull
(in which case appropriate error will be thrown or default value returned).boolean
protected boolean
protected boolean
double
asDouble()
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 valuesdouble
asDouble
(double defaultValue) Method similar toJsonNode.asDouble()
, but that will returndefaultValue
if this node cannot be coerced todouble
.Method similar toJsonNode.asDouble()
, but that will return (OptionalDouble.empty()
) if this node cannot be coerced todouble
.int
asInt()
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 inint
range).int
asInt
(int defaultValue) Method similar toJsonNode.intValue()
, but that will return specifieddefaultValue
if this node cannot be converted toint
.asIntOpt()
Method similar toJsonNode.asInt()
, but that will return (OptionalInt.empty()
) if this node cannot be coerced toint
.long
asLong()
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 inlong
range).long
asLong
(long defaultValue) Method similar toJsonNode.asLong()
, but that will return specifieddefaultValue
if 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
.Method that will try to access value of this node as aBigInteger
, but if node value cannot be expressed exactly as aBigInteger
, aJsonNodeException
will be thrown.bigIntegerValue
(BigInteger defaultValue) Method similar toJsonNode.bigIntegerValue()
, but that will return specifieddefaultValue
if 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
, aJsonNodeException
will be thrown.decimalValue
(BigDecimal defaultValue) Method similar toJsonNode.decimalValue()
, but that will returndefaultValue
if 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
.double
Method that will try to access value of this node as adouble
: but if node value cannot be expressed exactly as adouble
, aJsonNodeException
will be thrown.double
doubleValue
(double defaultValue) Method similar toJsonNode.doubleValue()
, but that will return specifieddefaultValue
if 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
.boolean
Equality for node objects is defined as full (deep) value equality.float
Method that will try to access value of this node as a Javafloat
: but if node value cannot be expressed exactly as afloat
, aJsonNodeException
will be thrown.int
hashCode()
int
intValue()
Method that will try to access value of this node as a Javaint
: but if node value cannot be expressed exactly as anint
, aJsonNodeException
will be thrown.int
intValue
(int defaultValue) Method similar toJsonNode.intValue()
, but that will return specifieddefaultValue
if 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
.boolean
long
Method that will try to access value of this node as a Javalong
: but if node value cannot be expressed exactly as along
, aJsonNodeException
will be thrown.long
longValue
(long defaultValue) Method similar toJsonNode.longValue()
, but that will return specifieddefaultValue
if 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 asNumber
that accurately represents its value, if (and only if) this is a number node (returnstrue
forJsonNode.isNumber()
).final void
serialize
(JsonGenerator g, SerializationContext provider) Method called to serialize node instances using given generator.static BigIntegerNode
Methods inherited from class tools.jackson.databind.node.NumericIntNode
asBigInteger, asBigInteger, asBigIntegerOpt, asDecimal, asDecimal, asDecimalOpt, asToken, canConvertToInt, canConvertToLong, isIntegralNumber, isNaN, shortValue
Methods inherited from class tools.jackson.databind.node.NumericNode
_valueDesc, deepCopy, getNodeType
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, _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, withObject
Methods 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, withObjectProperty
Methods inherited from class tools.jackson.databind.JacksonSerializable.Base
isEmpty
-
Field Details
-
_value
-
-
Constructor Details
-
BigIntegerNode
-
-
Method Details
-
valueOf
-
numberType
Description copied from class:BaseJsonNode
Returns code that identifies type of underlying numeric value, if (and only if) node is a number node.- Specified by:
numberType
in interfaceTreeNode
- Specified by:
numberType
in classNumericNode
-
isBigInteger
public boolean isBigInteger()- Overrides:
isBigInteger
in classJsonNode
-
_asBoolean
Description copied from class:BaseJsonNode
Method sub-classes should override if they can produceboolean
values viaBaseJsonNode.asBoolean()
-- if not, returnnull
(in which case appropriate error will be thrown or default value returned).- Overrides:
_asBoolean
in classBaseJsonNode
- Returns:
- Coerced value if possible; otherwise
null
to indicate this node cannot be coerced.
-
_asString
Description copied from class:BaseJsonNode
Method sub-classes should override if they can produceString
values viaBaseJsonNode.asString()
-- if not, returnnull
(in which case appropriate error will be thrown or default value returned).- Specified by:
_asString
in classNumericNode
- Returns:
- Coerced value if possible; otherwise
null
to indicate this node cannot be coerced.
-
numberValue
Description copied from class:JsonNode
Method that will try to access value of this node asNumber
that accurately represents its value, if (and only if) this is a number node (returnstrue
forJsonNode.isNumber()
). If this node is NOT a number node, aJsonNodeException
will be thrown.- Specified by:
numberValue
in classNumericNode
- Returns:
- Number value this node contains, if numeric node
-
intValue
public int intValue()Description copied from class:JsonNode
Method that will try to access value of this node as a Javaint
: but if node value cannot be expressed exactly as anint
, aJsonNodeException
will be thrown. Access works for following cases:- JSON Integer values that fit in Java 32-bit signed
int
range - JSON Floating-point values that fit in Java 32-bit signed
int
range AND do not have fractional part.
NOTE: for more lenient conversions, use
JsonNode.asInt()
- Specified by:
intValue
in classNumericNode
- Returns:
Int
value 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:JsonNode
Method similar toJsonNode.intValue()
, but that will return specifieddefaultValue
if this node cannot be converted to Javaint
.- Specified by:
intValue
in classNumericNode
- Parameters:
defaultValue
- Value to return if this node cannot be converted to Javaint
- Returns:
- Java
int
value this node represents, if possible to accurately represent;defaultValue
otherwise
-
intValueOpt
Description copied from class:JsonNode
Method similar toJsonNode.intValue()
, but that will return emptyOptionalInt
(OptionalInt.empty()
) if this node cannot be converted to Javaint
.- Specified by:
intValueOpt
in classNumericNode
- Returns:
- Java
int
value this node represents, asOptionalInt
, if possible to accurately represent;OptionalInt.empty()
otherwise
-
asInt
public int asInt()Description copied from class:JsonNode
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 for
JsonNode.intValue()
) will be truncated toint
(if (and only if) they fit inint
range). - JSON Strings that represent JSON Numbers ("stringified" numbers)
- JSON Null (converted to
0
)) - POJO nodes that contain Number values
- Specified by:
asInt
in classNumericNode
- Returns:
int
value 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:JsonNode
Method similar toJsonNode.intValue()
, but that will return specifieddefaultValue
if this node cannot be converted toint
.- Specified by:
asInt
in classNumericNode
- Parameters:
defaultValue
- Value to return if this node cannot be converted toint
- Returns:
int
value this node represents, if possible to accurately represent;defaultValue
otherwise
-
asIntOpt
Description copied from class:JsonNode
Method similar toJsonNode.asInt()
, but that will return (OptionalInt.empty()
) if this node cannot be coerced toint
.- Specified by:
asIntOpt
in classNumericNode
- Returns:
OptionalInt
value this node represents, if possible to accurately represent;OptionalInt.empty()
otherwise
-
longValue
public long longValue()Description copied from class:JsonNode
Method that will try to access value of this node as a Javalong
: but if node value cannot be expressed exactly as along
, aJsonNodeException
will be thrown. Access works for following cases:- JSON Integer values that fit in Java 64-bit signed
long
range - JSON Floating-point values that fit in Java 64-bit signed
long
range AND do not have fractional part.
NOTE: for more lenient conversions, use
JsonNode.asLong()
- Specified by:
longValue
in classNumericNode
- Returns:
Long
value 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:JsonNode
Method similar toJsonNode.longValue()
, but that will return specifieddefaultValue
if this node cannot be converted tolong
.- Specified by:
longValue
in classNumericNode
- Parameters:
defaultValue
- Value to return if this node cannot be converted tolong
- Returns:
long
value this node represents, if possible to accurately represent;defaultValue
otherwise
-
longValueOpt
Description copied from class:JsonNode
Method similar toJsonNode.longValue()
, but that will return emptyOptionalLong
(OptionalLong.empty()
) if this node cannot be converted to Javalong
.- Specified by:
longValueOpt
in classNumericNode
- Returns:
- Java
long
value this node represents, asOptionalLong
, if possible to accurately represent;OptionalLong.empty()
otherwise
-
asLong
public long asLong()Description copied from class:JsonNode
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 for
JsonNode.longValue()
) will be truncated tolong
(if (and only if) they fit inlong
range). - JSON Strings that represent JSON Numbers ("stringified" numbers)
- JSON Null (converted to
0
)) - POJO nodes that contain Number values
- Specified by:
asLong
in classNumericNode
- Returns:
long
value 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:JsonNode
Method similar toJsonNode.asLong()
, but that will return specifieddefaultValue
if this node cannot be coerced tolong
(instead of throwing an exception).- Specified by:
asLong
in classNumericNode
- Parameters:
defaultValue
- Value to return if this node cannot be coerced tolong
- Returns:
long
value this node represents, if possible to accurately represent;defaultValue
otherwise
-
asLongOpt
Description copied from class:JsonNode
Method similar toJsonNode.asLong()
, but that will return (OptionalLong.empty()
) if this node cannot be coerced tolong
.- Specified by:
asLongOpt
in classNumericNode
- Returns:
OptionalLong
value this node represents (or can be coerced to),OptionalLong.empty()
otherwise
-
bigIntegerValue
Description copied from class:JsonNode
Method that will try to access value of this node as aBigInteger
, but if node value cannot be expressed exactly as aBigInteger
, aJsonNodeException
will be thrown. Access works for following cases:- JSON Integer values
- JSON Floating-point values that do not have fractional part.
- Specified by:
bigIntegerValue
in classNumericIntNode
- Returns:
BigInteger
value this node represents, if possible to accurately represent
-
bigIntegerValue
Description copied from class:JsonNode
Method similar toJsonNode.bigIntegerValue()
, but that will return specifieddefaultValue
if this node cannot be converted to JavaBigInteger
.- Overrides:
bigIntegerValue
in classNumericIntNode
- Parameters:
defaultValue
- Value to return if this node cannot be converted to JavaBigInteger
- Returns:
- Java
BigInteger
value this node represents, if possible to accurately represent;defaultValue
otherwise
-
bigIntegerValueOpt
Description copied from class:JsonNode
Method similar toJsonNode.bigIntegerValue()
, but that will return empty (Optional.empty()
) if this node cannot be converted to JavaBigInteger
.- Overrides:
bigIntegerValueOpt
in classNumericIntNode
- Returns:
- Java
BigInteger
value this node represents, asOptional<BigInteger>
, if possible to accurately represent;Optional.empty()
otherwise
-
floatValue
public float floatValue()Description copied from class:JsonNode
Method that will try to access value of this node as a Javafloat
: but if node value cannot be expressed exactly as afloat
, aJsonNodeException
will be thrown. Access works for following cases:- JSON Floating-point values that fit in Java 32-bit
double
range - JSON Integer values that fit in Java 32-bit
double
range
- Overrides:
floatValue
in classNumericIntNode
- Returns:
Float
value this node represents, if possible to accurately represent
- JSON Floating-point values that fit in Java 32-bit
-
doubleValue
public double doubleValue()Description copied from class:JsonNode
Method that will try to access value of this node as adouble
: but if node value cannot be expressed exactly as adouble
, aJsonNodeException
will be thrown. Access works for following cases:- JSON Floating-point values that fit in Java 64-bit
double
range - JSON Integer values that fit in Java 64-bit
double
range
NOTE: for more lenient conversions, use
JsonNode.asDouble()
- Overrides:
doubleValue
in classNumericIntNode
- Returns:
Double
value 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:JsonNode
Method similar toJsonNode.doubleValue()
, but that will return specifieddefaultValue
if this node cannot be converted todouble
.- Overrides:
doubleValue
in classNumericIntNode
- Parameters:
defaultValue
- Value to return if this node cannot be converted todouble
- Returns:
double
value this node represents, if possible to accurately represent;defaultValue
otherwise
-
doubleValueOpt
Description copied from class:JsonNode
Method similar toJsonNode.doubleValue()
, but that will return emptyOptionalLong
(OptionalDouble.empty()
) if this node cannot be converted to Javadouble
.- Overrides:
doubleValueOpt
in classNumericIntNode
- Returns:
- Java
double
value this node represents, asOptionalDouble
, if possible to accurately represent;OptionalDouble.empty()
otherwise
-
asDouble
public double asDouble()Description copied from class:JsonNode
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 to
0.0d
) - POJO nodes that contain Number values
- Overrides:
asDouble
in classNumericIntNode
- Returns:
double
value this node represents, if possible to accurately represent
-
asDouble
public double asDouble(double defaultValue) Description copied from class:JsonNode
Method similar toJsonNode.asDouble()
, but that will returndefaultValue
if this node cannot be coerced todouble
.- Overrides:
asDouble
in classNumericIntNode
- Returns:
double
value this node represents, if possible to accurately represent;defaultValue
otherwise
-
asDoubleOpt
Description copied from class:JsonNode
Method similar toJsonNode.asDouble()
, but that will return (OptionalDouble.empty()
) if this node cannot be coerced todouble
.- Overrides:
asDoubleOpt
in classNumericIntNode
- Returns:
OptionalDouble
value this node represents, if possible to accurately represent;OptionalDouble.empty()
otherwise
-
decimalValue
Description copied from class:JsonNode
Method that will try to access value of this node as a JavaBigDecimal
: but if node value cannot be expressed exactly as aBigDecimal
, aJsonNodeException
will be thrown. Access works for following cases:- All JSON Number values
NOTE: for more lenient conversions, use
JsonNode.asDecimal()
- Specified by:
decimalValue
in classNumericNode
- Returns:
BigDecimal
value this node represents, if possible to accurately represent
-
decimalValue
Description copied from class:JsonNode
Method similar toJsonNode.decimalValue()
, but that will returndefaultValue
if this node cannot be coerced to JavaBigDecimal
.- Overrides:
decimalValue
in classNumericIntNode
- Returns:
BigDecimal
value this node represents, if possible to accurately represent;defaultValue
otherwise
-
decimalValueOpt
Description copied from class:JsonNode
Method similar toJsonNode.decimalValue()
, but that will return emptyOptional
(Optional.empty()
) if this node cannot be coerced toBigDecimal
.- Overrides:
decimalValueOpt
in classNumericIntNode
- Returns:
- Java
BigDecimal
value this node represents, asOptional<BigDecimal>
, if possible to accurately represent;Optional.empty()
otherwise
-
_asIntValueUnchecked
protected int _asIntValueUnchecked()- Specified by:
_asIntValueUnchecked
in classNumericIntNode
-
_asFloatValueUnchecked
protected float _asFloatValueUnchecked()- Specified by:
_asFloatValueUnchecked
in classNumericIntNode
-
_asDoubleValueUnchecked
protected double _asDoubleValueUnchecked()- Specified by:
_asDoubleValueUnchecked
in classNumericIntNode
-
_inShortRange
protected boolean _inShortRange()- Specified by:
_inShortRange
in classNumericIntNode
-
_inIntRange
public boolean _inIntRange()- Specified by:
_inIntRange
in classNumericIntNode
-
_inLongRange
protected boolean _inLongRange()- Specified by:
_inLongRange
in classNumericIntNode
-
serialize
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:
JacksonException
-
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
. -
hashCode
public int hashCode()- Specified by:
hashCode
in classBaseJsonNode
-