@Override
  public <T> Codec<T> get(Class<T> clazz) {
    final JavaType javaType = mapper.getTypeFactory().constructType(clazz);

    try {
      JsonSerializer<?> ser = mapper.getSerializerProviderInstance().findValueSerializer(javaType);
      if (ser instanceof Wrapper) {
        @SuppressWarnings("unchecked")
        Codec<T> codec = ((Wrapper<Codec<T>>) ser).unwrap();
        return codec;
      }
    } catch (JsonMappingException e) {
      throw new CodecConfigurationException("Exception for " + javaType, e);
    }

    throw new CodecConfigurationException(javaType + " not supported");
  }
Tries to find native codec for BSON types (if supported). Avoid using jackson indirection if
reading / writing only BSON (eg. {@link org.bson.BsonDocument})
criteria/mongo/src/org/immutables/criteria/mongo/bson4jackson/NativeCodecRegistry.java