Example #1
0
 private Class guessCollectionGenericType(SinglePropertyMetadata metadata) {
   if (metadata.getGetter() != null) {
     return GenericCollectionTypeResolver.getCollectionReturnType(metadata.getGetter());
   } else if (metadata.getSetter() != null) {
     return GenericCollectionTypeResolver.getCollectionParameterType(
         new MethodParameter(metadata.getSetter(), 0));
   } else if (metadata.getField() != null) {
     return GenericCollectionTypeResolver.getCollectionFieldType(metadata.getField());
   }
   return null;
 }
Example #2
0
 private Class[] guessMapGenericType(SinglePropertyMetadata metadata) {
   Method getter = metadata.getGetter();
   Method setter = metadata.getSetter();
   Field field = metadata.getField();
   if (getter != null) {
     return new Class[] {
       GenericCollectionTypeResolver.getMapKeyReturnType(getter),
       GenericCollectionTypeResolver.getMapValueReturnType(getter)
     };
   } else if (setter != null) {
     MethodParameter methodParam = new MethodParameter(setter, 0);
     return new Class[] {
       GenericCollectionTypeResolver.getMapKeyParameterType(methodParam),
       GenericCollectionTypeResolver.getMapValueParameterType(methodParam),
     };
   } else if (field != null) {
     return new Class[] {
       GenericCollectionTypeResolver.getMapKeyFieldType(field),
       GenericCollectionTypeResolver.getMapValueFieldType(field)
     };
   }
   return null;
 }