Package org.bson

Enum BsonType

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<BsonType>

    public enum BsonType
    extends java.lang.Enum<BsonType>
    Enumeration of all the BSON types currently supported.
    Since:
    3.0
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static BsonType findByValue​(int value)
      Gets the BsonType that corresponds to the given int value.
      int getValue()
      Get the int value of this BSON type.
      boolean isContainer()
      Returns whether this type is some sort of containing type, e.g.
      static BsonType valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static BsonType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • 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 Detail

      • values

        public static BsonType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (BsonType c : BsonType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static BsonType valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.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