Package org.bson
Class BsonValue
- java.lang.Object
- 
- org.bson.BsonValue
 
- 
- Direct Known Subclasses:
- BsonArray,- BsonBinary,- BsonBoolean,- BsonDateTime,- BsonDbPointer,- BsonDocument,- BsonJavaScript,- BsonJavaScriptWithScope,- BsonMaxKey,- BsonMinKey,- BsonNull,- BsonNumber,- BsonObjectId,- BsonRegularExpression,- BsonString,- BsonSymbol,- BsonTimestamp,- BsonUndefined
 
 public abstract class BsonValue extends Object Base class for any BSON type.- Since:
- 3.0
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description BsonArrayasArray()Gets this value as a BsonArray if it is one, otherwise throws exceptionBsonBinaryasBinary()Gets this value as a BsonBinary if it is one, otherwise throws exceptionBsonBooleanasBoolean()Gets this value as a BsonBoolean if it is one, otherwise throws exceptionBsonDateTimeasDateTime()Gets this value as a BsonDateTime if it is one, otherwise throws exceptionBsonDbPointerasDBPointer()Gets this value as a BsonDbPointer if it is one, otherwise throws exceptionBsonDecimal128asDecimal128()Gets this value as a BsonDecimal128 if it is one, otherwise throws exceptionBsonDocumentasDocument()Gets this value as a BsonDocument if it is one, otherwise throws exceptionBsonDoubleasDouble()Gets this value as a BsonDouble if it is one, otherwise throws exceptionBsonInt32asInt32()Gets this value as a BsonInt32 if it is one, otherwise throws exceptionBsonInt64asInt64()Gets this value as a BsonInt64 if it is one, otherwise throws exceptionBsonJavaScriptasJavaScript()Gets this value as aBsonJavaScriptif it is one, otherwise throws exceptionBsonJavaScriptWithScopeasJavaScriptWithScope()Gets this value as a BsonJavaScriptWithScope if it is one, otherwise throws exceptionBsonNumberasNumber()Gets this value as a BsonNumber if it is one, otherwise throws exceptionBsonObjectIdasObjectId()Gets this value as an BsonObjectId if it is one, otherwise throws exceptionBsonRegularExpressionasRegularExpression()Gets this value as a BsonRegularExpression if it is one, otherwise throws exceptionBsonStringasString()Gets this value as a BsonString if it is one, otherwise throws exceptionBsonSymbolasSymbol()Gets this value as a BsonSymbol if it is one, otherwise throws exceptionBsonTimestampasTimestamp()Gets this value as a BsonTimestamp if it is one, otherwise throws exceptionabstract BsonTypegetBsonType()Gets the BSON type of this value.booleanisArray()Returns true if this is a BsonArray, false otherwise.booleanisBinary()Returns true if this is a BsonBinary, false otherwise.booleanisBoolean()Returns true if this is a BsonBoolean, false otherwise.booleanisDateTime()Returns true if this is a BsonDateTime, false otherwise.booleanisDBPointer()Returns true if this is a BsonDbPointer, false otherwise.booleanisDecimal128()Returns true if this is a BsonDecimal128, false otherwise.booleanisDocument()Returns true if this is a BsonDocument, false otherwise.booleanisDouble()Returns true if this is a BsonDouble, false otherwise.booleanisInt32()Returns true if this is a BsonInt32, false otherwise.booleanisInt64()Returns true if this is a BsonInt64, false otherwise.booleanisJavaScript()Returns true if this is a BsonJavaScript, false otherwise.booleanisJavaScriptWithScope()Returns true if this is a BsonJavaScriptWithScope, false otherwise.booleanisNull()Returns true if this is a BsonNull, false otherwise.booleanisNumber()Returns true if this is a BsonNumber, false otherwise.booleanisObjectId()Returns true if this is an BsonObjectId, false otherwise.booleanisRegularExpression()Returns true if this is a BsonRegularExpression, false otherwise.booleanisString()Returns true if this is a BsonString, false otherwise.booleanisSymbol()Returns true if this is a BsonSymbol, false otherwise.booleanisTimestamp()Returns true if this is a BsonTimestamp, false otherwise.
 
- 
- 
- 
Method Detail- 
getBsonTypepublic abstract BsonType getBsonType() Gets the BSON type of this value.- Returns:
- the BSON type, which may not be null (but may be BSONType.NULL)
 
 - 
asDocumentpublic BsonDocument asDocument() Gets this value as a BsonDocument if it is one, otherwise throws exception- Returns:
- a BsonDocument
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asArraypublic BsonArray asArray() Gets this value as a BsonArray if it is one, otherwise throws exception- Returns:
- a BsonArray
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asStringpublic BsonString asString() Gets this value as a BsonString if it is one, otherwise throws exception- Returns:
- a BsonString
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asNumberpublic BsonNumber asNumber() Gets this value as a BsonNumber if it is one, otherwise throws exception- Returns:
- a BsonNumber
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asInt32public BsonInt32 asInt32() Gets this value as a BsonInt32 if it is one, otherwise throws exception- Returns:
- a BsonInt32
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asInt64public BsonInt64 asInt64() Gets this value as a BsonInt64 if it is one, otherwise throws exception- Returns:
- a BsonInt64
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asDecimal128public BsonDecimal128 asDecimal128() Gets this value as a BsonDecimal128 if it is one, otherwise throws exception- Returns:
- a BsonDecimal128
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
- Since:
- 3.4
 
 - 
asDoublepublic BsonDouble asDouble() Gets this value as a BsonDouble if it is one, otherwise throws exception- Returns:
- a BsonDouble
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asBooleanpublic BsonBoolean asBoolean() Gets this value as a BsonBoolean if it is one, otherwise throws exception- Returns:
- a BsonBoolean
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asObjectIdpublic BsonObjectId asObjectId() Gets this value as an BsonObjectId if it is one, otherwise throws exception- Returns:
- an BsonObjectId
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asDBPointerpublic BsonDbPointer asDBPointer() Gets this value as a BsonDbPointer if it is one, otherwise throws exception- Returns:
- an BsonDbPointer
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asTimestamppublic BsonTimestamp asTimestamp() Gets this value as a BsonTimestamp if it is one, otherwise throws exception- Returns:
- an BsonTimestamp
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asBinarypublic BsonBinary asBinary() Gets this value as a BsonBinary if it is one, otherwise throws exception- Returns:
- an BsonBinary
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asDateTimepublic BsonDateTime asDateTime() Gets this value as a BsonDateTime if it is one, otherwise throws exception- Returns:
- an BsonDateTime
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asSymbolpublic BsonSymbol asSymbol() Gets this value as a BsonSymbol if it is one, otherwise throws exception- Returns:
- an BsonSymbol
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asRegularExpressionpublic BsonRegularExpression asRegularExpression() Gets this value as a BsonRegularExpression if it is one, otherwise throws exception- Returns:
- an BsonRegularExpression
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asJavaScriptpublic BsonJavaScript asJavaScript() Gets this value as aBsonJavaScriptif it is one, otherwise throws exception- Returns:
- a BsonJavaScript
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
asJavaScriptWithScopepublic BsonJavaScriptWithScope asJavaScriptWithScope() Gets this value as a BsonJavaScriptWithScope if it is one, otherwise throws exception- Returns:
- a BsonJavaScriptWithScope
- Throws:
- BsonInvalidOperationException- if this value is not of the expected type
 
 - 
isNullpublic boolean isNull() Returns true if this is a BsonNull, false otherwise.- Returns:
- true if this is a BsonNull, false otherwise
 
 - 
isDocumentpublic boolean isDocument() Returns true if this is a BsonDocument, false otherwise.- Returns:
- true if this is a BsonDocument, false otherwise
 
 - 
isArraypublic boolean isArray() Returns true if this is a BsonArray, false otherwise.- Returns:
- true if this is a BsonArray, false otherwise
 
 - 
isStringpublic boolean isString() Returns true if this is a BsonString, false otherwise.- Returns:
- true if this is a BsonString, false otherwise
 
 - 
isNumberpublic boolean isNumber() Returns true if this is a BsonNumber, false otherwise.- Returns:
- true if this is a BsonNumber, false otherwise
 
 - 
isInt32public boolean isInt32() Returns true if this is a BsonInt32, false otherwise.- Returns:
- true if this is a BsonInt32, false otherwise
 
 - 
isInt64public boolean isInt64() Returns true if this is a BsonInt64, false otherwise.- Returns:
- true if this is a BsonInt64, false otherwise
 
 - 
isDecimal128public boolean isDecimal128() Returns true if this is a BsonDecimal128, false otherwise.- Returns:
- true if this is a BsonDecimal128, false otherwise
- Since:
- 3.4
 
 - 
isDoublepublic boolean isDouble() Returns true if this is a BsonDouble, false otherwise.- Returns:
- true if this is a BsonDouble, false otherwise
 
 - 
isBooleanpublic boolean isBoolean() Returns true if this is a BsonBoolean, false otherwise.- Returns:
- true if this is a BsonBoolean, false otherwise
 
 - 
isObjectIdpublic boolean isObjectId() Returns true if this is an BsonObjectId, false otherwise.- Returns:
- true if this is an BsonObjectId, false otherwise
 
 - 
isDBPointerpublic boolean isDBPointer() Returns true if this is a BsonDbPointer, false otherwise.- Returns:
- true if this is a BsonDbPointer, false otherwise
 
 - 
isTimestamppublic boolean isTimestamp() Returns true if this is a BsonTimestamp, false otherwise.- Returns:
- true if this is a BsonTimestamp, false otherwise
 
 - 
isBinarypublic boolean isBinary() Returns true if this is a BsonBinary, false otherwise.- Returns:
- true if this is a BsonBinary, false otherwise
 
 - 
isDateTimepublic boolean isDateTime() Returns true if this is a BsonDateTime, false otherwise.- Returns:
- true if this is a BsonDateTime, false otherwise
 
 - 
isSymbolpublic boolean isSymbol() Returns true if this is a BsonSymbol, false otherwise.- Returns:
- true if this is a BsonSymbol, false otherwise
 
 - 
isRegularExpressionpublic boolean isRegularExpression() Returns true if this is a BsonRegularExpression, false otherwise.- Returns:
- true if this is a BsonRegularExpression, false otherwise
 
 - 
isJavaScriptpublic boolean isJavaScript() Returns true if this is a BsonJavaScript, false otherwise.- Returns:
- true if this is a BsonJavaScript, false otherwise
 
 - 
isJavaScriptWithScopepublic boolean isJavaScriptWithScope() Returns true if this is a BsonJavaScriptWithScope, false otherwise.- Returns:
- true if this is a BsonJavaScriptWithScope, false otherwise
 
 
- 
 
-