Package org.bson
Class BsonNumber
java.lang.Object
org.bson.BsonValue
org.bson.BsonNumber
- Direct Known Subclasses:
BsonDecimal128
,BsonDouble
,BsonInt32
,BsonInt64
Base class for the numeric BSON types. This class mirrors the functionality provided by
java.lang.Number
.- Since:
- 3.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract Decimal128
Returns the value of the specified number as aDecimal128
, which may involve rounding.abstract double
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
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
-
Constructor Details
-
BsonNumber
public BsonNumber()
-
-
Method Details
-
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
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
-