mongovalues.JsObjCodecProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mongo-values Show documentation
Show all versions of mongo-values Show documentation
Set of codecs to add support for json-values in the Java MongoDB driver, abstracting the process of
decoding a BSON into a JsObj and encoding a JsObj into a BSON.
The newest version!
package mongovalues;
import jsonvalues.JsObj;
import org.bson.codecs.BsonTypeClassMap;
import org.bson.codecs.Codec;
import org.bson.codecs.configuration.CodecProvider;
import org.bson.codecs.configuration.CodecRegistry;
class JsObjCodecProvider implements CodecProvider {
private final BsonTypeClassMap typeClassMap;
public JsObjCodecProvider(final BsonTypeClassMap typeClassMap) {
this.typeClassMap = typeClassMap;
}
@Override
@SuppressWarnings("unchecked")
public Codec get(final Class aclass,
final CodecRegistry codecRegistry) {
if (aclass == JsObj.class) {
return (Codec) new JsObjCodec(codecRegistry,
typeClassMap);
}
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy