Package org.bson.codecs
Class BsonValueCodecProvider
java.lang.Object
org.bson.codecs.BsonValueCodecProvider
- All Implemented Interfaces:
CodecProvider
A
CodecProvider
for all subclass of BsonValue.- Since:
- 3.0
-
Constructor Summary
ConstructorDescriptionConstruct a new instance with the default codec for each BSON type. -
Method Summary
Modifier and TypeMethodDescription<T> Codec<T>
get
(Class<T> clazz, CodecRegistry registry) Get aCodec
using the given context, which includes, most importantly, the Class for which aCodec
is required.static BsonTypeClassMap
Gets the BsonTypeClassMap used by this provider.getClassForBsonType
(BsonType bsonType) Get theBsonValue
subclass associated with the givenBsonType
.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.bson.codecs.configuration.CodecProvider
get
-
Constructor Details
-
BsonValueCodecProvider
public BsonValueCodecProvider()Construct a new instance with the default codec for each BSON type.
-
-
Method Details
-
getClassForBsonType
Get theBsonValue
subclass associated with the givenBsonType
.- Parameters:
bsonType
- the BsonType- Returns:
- the class associated with the given type
-
getBsonTypeClassMap
Gets the BsonTypeClassMap used by this provider.- Returns:
- the non-null BsonTypeClassMap
- Since:
- 3.3
-
get
Description copied from interface:CodecProvider
Get aCodec
using the given context, which includes, most importantly, the Class for which aCodec
is required.This method is called by the driver only if
CodecProvider.get(Class, List, CodecRegistry)
is not overridden, or is overridden such that it calls this method.- Specified by:
get
in interfaceCodecProvider
- Type Parameters:
T
- the type of the class for which a Codec is required- Parameters:
clazz
- the Class for which to get a Codecregistry
- the registry to use for resolving dependent Codec instances- Returns:
- the Codec instance, which may be null, if this source is unable to provide one for the requested Class
-
toString
-