Package org.bson
Enum BsonType
- java.lang.Object
-
- java.lang.Enum<BsonType>
-
- org.bson.BsonType
-
- All Implemented Interfaces:
Serializable
,Comparable<BsonType>
public enum BsonType extends Enum<BsonType>
Enumeration of all the BSON types currently supported.- Since:
- 3.0
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ARRAY
A BSON array.BINARY
BSON binary data.BOOLEAN
A BSON bool.DATE_TIME
A BSON DateTime.DB_POINTER
A BSON regular expression.DECIMAL128
A BSON Decimal128.DOCUMENT
A BSON document.DOUBLE
A BSON double.END_OF_DOCUMENT
Not a real BSON type.INT32
A BSON 32-bit integer.INT64
A BSON 64-bit integer.JAVASCRIPT
BSON JavaScript code.JAVASCRIPT_WITH_SCOPE
BSON JavaScript code with a scope (a set of variables with values).MAX_KEY
A BSON MaxKey value.MIN_KEY
A BSON MinKey value.NULL
A BSON null value.OBJECT_ID
A BSON ObjectId.REGULAR_EXPRESSION
A BSON regular expression.STRING
A BSON string.SYMBOL
A BSON symbol.TIMESTAMP
A BSON timestamp.UNDEFINED
A BSON undefined value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BsonType
findByValue(int value)
Gets theBsonType
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(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.
-
-
-
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(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:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- 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 theBsonType
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
-
-