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

Java driver cannot handle Deeper Polymorphic trees

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.3.4
    • Component/s: BSON, Codecs, POJO
    • Labels:
    • 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?

      The Pojo codec is limited in handling multiple level generic types that are passed through the class heirarchy.

      Take the following classes:

      abstract class GenericBaseModel<A, B, C> {
      
          private A alpha;
          private B bravo;
          private C charlie;
         
         // ... getters & setters
      }
      
      public abstract class GenericPassThroughModel<A, B, C> extends GenericBaseModel<C, B, A> {
      
      }
      
      public final class GenericPassThroughModelImpl extends GenericPassThroughModel<List<String>, Integer, String> {
      
      }
      

      The concrete types of GenericPassThroughModelImpl are lost due to the PojoCodecs type detection.


      See first comment for the previous description.

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            contact@gjstewart.net Greg Stewart
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: