All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mongovalues.JsObjCodecProvider Maven / Gradle / Ivy

Go to download

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