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

Validate map types

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: POJO

      Validate Map types to ensure when writing to the Pojo or to MongoDB they are of type Map<String, ?>. Check any concrete Map implementations eg:

       Type[] genericInterfaces = Document.class.getGenericInterfaces();
              for (var type : genericInterfaces) {
                  if (type instanceof ParameterizedType parameterizedType) {
                      System.out.println(parameterizedType.getRawType().getTypeName());
                      for (var typeArguments : parameterizedType.getActualTypeArguments()) {
                          System.out.println("   " + typeArguments.getTypeName());
                      }
                  }
              }
      prints:
      
      java.util.Map
         java.lang.String
         java.lang.Object
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            ross@mongodb.com Ross Lawley
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: