Package org.bson

Enum Class BsonType

All Implemented Interfaces:
Serializable, Comparable<BsonType>, java.lang.constant.Constable

public enum BsonType extends Enum<BsonType>
Enumeration of all the BSON types currently supported.
Since:
3.0
  • Enum Constant Details

    • END_OF_DOCUMENT

      public static final BsonType END_OF_DOCUMENT
      Not a real BSON type. Used to signal the end of a document.
    • DOUBLE

      public static final BsonType DOUBLE
      A BSON double.
    • STRING

      public static final BsonType STRING
      A BSON string.
    • DOCUMENT

      public static final BsonType DOCUMENT
      A BSON document.
    • ARRAY

      public static final BsonType ARRAY
      A BSON array.
    • BINARY

      public static final BsonType BINARY
      BSON binary data.
    • UNDEFINED

      public static final BsonType UNDEFINED
      A BSON undefined value.
    • OBJECT_ID

      public static final BsonType OBJECT_ID
      A BSON ObjectId.
    • BOOLEAN

      public static final BsonType BOOLEAN
      A BSON bool.
    • DATE_TIME

      public static final BsonType DATE_TIME
      A BSON DateTime.
    • NULL

      public static final BsonType NULL
      A BSON null value.
    • REGULAR_EXPRESSION

      public static final BsonType REGULAR_EXPRESSION
      A BSON regular expression.
    • DB_POINTER

      public static final BsonType DB_POINTER
      A BSON regular expression.
    • JAVASCRIPT

      public static final BsonType JAVASCRIPT
      BSON JavaScript code.
    • SYMBOL

      public static final BsonType SYMBOL
      A BSON symbol.
    • JAVASCRIPT_WITH_SCOPE

      public static final BsonType JAVASCRIPT_WITH_SCOPE
      BSON JavaScript code with a scope (a set of variables with values).
    • INT32

      public static final BsonType INT32
      A BSON 32-bit integer.
    • TIMESTAMP

      public static final BsonType TIMESTAMP
      A BSON timestamp.
    • INT64

      public static final BsonType INT64
      A BSON 64-bit integer.
    • DECIMAL128

      public static final BsonType DECIMAL128
      A BSON Decimal128.
      Since:
      3.4
    • MIN_KEY

      public static final BsonType MIN_KEY
      A BSON MinKey value.
    • MAX_KEY

      public static final BsonType MAX_KEY
      A BSON MaxKey value.
  • Method Details

    • values

      public static BsonType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static BsonType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getValue

      public int getValue()
      Get the int value of this BSON type.
      Returns:
      the int value of this type.
    • findByValue

      public static BsonType findByValue(int value)
      Gets the BsonType that corresponds to the given int value.
      Parameters:
      value - the int value of the desired BSON type.
      Returns:
      the corresponding BsonType
    • isContainer

      public boolean isContainer()
      Returns whether this type is some sort of containing type, e.g. a document or array.
      Returns:
      true if this is some sort of containing type rather than a primitive value