Package de.bild.codec

Class PojoContext

java.lang.Object
de.bild.codec.PojoContext

public class PojoContext extends Object
  • Method Details

    • get

      public <T> org.bson.codecs.Codec<T> get(Class<T> clazz, org.bson.codecs.configuration.CodecRegistry registry)
    • getCodec

      public <T> org.bson.codecs.Codec<T> getCodec(Type type, TypeCodecRegistry typeCodecRegistry)
      Calculates and returns a codec for the given type, null otherwise
      Type Parameters:
      T - the value type
      Parameters:
      type - type for which a codec is requested
      typeCodecRegistry - codec registry that can handle any type including parameterizd types, generic arrays, etc
      Returns:
      the codec responsible for the given type or null
    • resolve

      public <T> PolymorphicCodec<T> resolve(Type type, TypeCodecRegistry typeCodecRegistry)
      Iterates over the list of codecResolvers and returns a PolymorphicCodec if match is found. Codecs eligible to encode/decode sub classes of polymorphic structures need to provide special functionality and can be registered during setup of the PojoCodecProvider PojoCodecProvider.Builder.registerCodecResolver(CodecResolver[])
      Parameters:
      type - the value type
      typeCodecRegistry - codec registry that can handle any type including parameterizd types, generic arrays, etc
      Returns:
      PolymorphicCodec if responsible resolver is found