Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-4954

Refactor PojoCodec to leverage CodecProvider.get(clazz, typeArguments, registry)

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: POJO
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Update: the Parameterizable interface was replaced with CodecProvider.get(Class<T> clazz, List<Type> typeArguments, CodecRegistry registry).

      The Parameterizable interface was introduced along with RecordCodec to allow it to be deeply immutable even in the face of type parameters. We can make PojoCodec similarly immutable by having it make use of this interface. There are a few aspects to this

      • PojoCodec implements Parameterizable
      • PojoCodec uses CodecRegistry#get(java.lang.Class<T>, java.util.List<java.lang.reflect.Type>) to resolve codecs for parameterized POJO types, including nested POJOs and collections. Doing this for collections may be tricky since a different mechanism was introduced in JAVA-2554 that may conflict with this effort.

      The end result should be that the full set of parameterized codecs is resolved before the codec is ever used for encoding or decoding.

            Assignee:
            valentin.kovalenko@mongodb.com Valentin Kavalenka
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: