Package org.bson
Class BsonNumber
- java.lang.Object
-
- org.bson.BsonValue
-
- org.bson.BsonNumber
-
- Direct Known Subclasses:
BsonDecimal128
,BsonDouble
,BsonInt32
,BsonInt64
public abstract class BsonNumber extends BsonValue
Base class for the three numeric BSON types. This class mirrors the functionality provided byjava.lang.Number
.- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description BsonNumber()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract Decimal128
decimal128Value()
Returns the value of the specified number as aDecimal128
, which may involve rounding.abstract double
doubleValue()
Returns the value of the specified number as adouble
, which may involve rounding.abstract int
intValue()
Returns the value of the specified number as anint
, which may involve rounding or truncation.abstract long
longValue()
Returns the value of the specified number as anlong
, which may involve rounding or truncation.-
Methods inherited from class org.bson.BsonValue
asArray, asBinary, asBoolean, asDateTime, asDBPointer, asDecimal128, asDocument, asDouble, asInt32, asInt64, asJavaScript, asJavaScriptWithScope, asNumber, asObjectId, asRegularExpression, asString, asSymbol, asTimestamp, getBsonType, isArray, isBinary, isBoolean, isDateTime, isDBPointer, isDecimal128, isDocument, isDouble, isInt32, isInt64, isJavaScript, isJavaScriptWithScope, isNull, isNumber, isObjectId, isRegularExpression, isString, isSymbol, isTimestamp
-
-
-
-
Method Detail
-
intValue
public abstract int intValue()
Returns the value of the specified number as anint
, which may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to type
int
.
-
longValue
public abstract long longValue()
Returns the value of the specified number as anlong
, which may involve rounding or truncation.- Returns:
- the numeric value represented by this object after conversion to type
long
.
-
doubleValue
public abstract double doubleValue()
Returns the value of the specified number as adouble
, which may involve rounding.- Returns:
- the numeric value represented by this object after conversion to type
double
.
-
decimal128Value
public abstract Decimal128 decimal128Value()
Returns the value of the specified number as aDecimal128
, which may involve rounding.- Returns:
- the numeric value represented by this object after conversion to type
Decimal128
. - Since:
- 3.4
-
-