Package org.bson

Class BsonNumber

Direct Known Subclasses:
BsonDecimal128, BsonDouble, BsonInt32, BsonInt64

public abstract class BsonNumber extends BsonValue
Base class for the numeric BSON types. This class mirrors the functionality provided by java.lang.Number.
Since:
3.0
  • Constructor Details

    • BsonNumber

      public BsonNumber()
  • Method Details

    • intValue

      public abstract int intValue()
      Returns the value of the specified number as an int, 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 an long, 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 a double, 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 a Decimal128, which may involve rounding.
      Returns:
      the numeric value represented by this object after conversion to type Decimal128.
      Since:
      3.4