public abstract class GenericCollectionTypeResolver extends Object
Mainly intended for usage within the framework, determining the target type of values to be added to a collection or map (to be able to attempt type conversion if appropriate).
ResolvableType| Constructor and Description |
|---|
GenericCollectionTypeResolver() |
| Modifier and Type | Method and Description |
|---|---|
static Class<?> |
getCollectionFieldType(Field collectionField)
Determine the generic element type of the given Collection field.
|
static Class<?> |
getCollectionFieldType(Field collectionField,
int nestingLevel)
Determine the generic element type of the given Collection field.
|
static Class<?> |
getCollectionFieldType(Field collectionField,
int nestingLevel,
Map<Integer,Integer> typeIndexesPerLevel)
Deprecated.
as of 4.0, in favor of using
ResolvableType for arbitrary nesting levels |
static Class<?> |
getCollectionParameterType(MethodParameter methodParam)
Determine the generic element type of the given Collection parameter.
|
static Class<?> |
getCollectionReturnType(Method method)
Determine the generic element type of the given Collection return type.
|
static Class<?> |
getCollectionReturnType(Method method,
int nestingLevel)
Determine the generic element type of the given Collection return type.
|
static Class<?> |
getCollectionType(Class<? extends Collection> collectionClass)
Determine the generic element type of the given Collection class
(if it declares one through a generic superclass or generic interface).
|
static Class<?> |
getMapKeyFieldType(Field mapField)
Determine the generic key type of the given Map field.
|
static Class<?> |
getMapKeyFieldType(Field mapField,
int nestingLevel)
Determine the generic key type of the given Map field.
|
static Class<?> |
getMapKeyFieldType(Field mapField,
int nestingLevel,
Map<Integer,Integer> typeIndexesPerLevel)
Deprecated.
as of 4.0, in favor of using
ResolvableType for arbitrary nesting levels |
static Class<?> |
getMapKeyParameterType(MethodParameter methodParam)
Determine the generic key type of the given Map parameter.
|
static Class<?> |
getMapKeyReturnType(Method method)
Determine the generic key type of the given Map return type.
|
static Class<?> |
getMapKeyReturnType(Method method,
int nestingLevel)
Determine the generic key type of the given Map return type.
|
static Class<?> |
getMapKeyType(Class<? extends Map> mapClass)
Determine the generic key type of the given Map class
(if it declares one through a generic superclass or generic interface).
|
static Class<?> |
getMapValueFieldType(Field mapField)
Determine the generic value type of the given Map field.
|
static Class<?> |
getMapValueFieldType(Field mapField,
int nestingLevel)
Determine the generic value type of the given Map field.
|
static Class<?> |
getMapValueFieldType(Field mapField,
int nestingLevel,
Map<Integer,Integer> typeIndexesPerLevel)
Deprecated.
as of 4.0, in favor of using
ResolvableType for arbitrary nesting levels |
static Class<?> |
getMapValueParameterType(MethodParameter methodParam)
Determine the generic value type of the given Map parameter.
|
static Class<?> |
getMapValueReturnType(Method method)
Determine the generic value type of the given Map return type.
|
static Class<?> |
getMapValueReturnType(Method method,
int nestingLevel)
Determine the generic value type of the given Map return type.
|
static Class<?> |
getMapValueType(Class<? extends Map> mapClass)
Determine the generic value type of the given Map class
(if it declares one through a generic superclass or generic interface).
|
public static Class<?> getCollectionType(Class<? extends Collection> collectionClass)
collectionClass - the collection class to introspectnull if nonepublic static Class<?> getMapKeyType(Class<? extends Map> mapClass)
mapClass - the map class to introspectnull if nonepublic static Class<?> getMapValueType(Class<? extends Map> mapClass)
mapClass - the map class to introspectnull if nonepublic static Class<?> getCollectionFieldType(Field collectionField)
collectionField - the collection field to introspectnull if nonepublic static Class<?> getCollectionFieldType(Field collectionField, int nestingLevel)
collectionField - the collection field to introspectnestingLevel - the nesting level of the target type
(typically 1; e.g. in case of a List of Lists, 1 would indicate the
nested List, whereas 2 would indicate the element of the nested List)null if none@Deprecated public static Class<?> getCollectionFieldType(Field collectionField, int nestingLevel, Map<Integer,Integer> typeIndexesPerLevel)
ResolvableType for arbitrary nesting levelscollectionField - the collection field to introspectnestingLevel - the nesting level of the target type
(typically 1; e.g. in case of a List of Lists, 1 would indicate the
nested List, whereas 2 would indicate the element of the nested List)typeIndexesPerLevel - Map keyed by nesting level, with each value
expressing the type index for traversal at that levelnull if nonepublic static Class<?> getMapKeyFieldType(Field mapField)
mapField - the map field to introspectnull if nonepublic static Class<?> getMapKeyFieldType(Field mapField, int nestingLevel)
mapField - the map field to introspectnestingLevel - the nesting level of the target type
(typically 1; e.g. in case of a List of Lists, 1 would indicate the
nested List, whereas 2 would indicate the element of the nested List)null if none@Deprecated public static Class<?> getMapKeyFieldType(Field mapField, int nestingLevel, Map<Integer,Integer> typeIndexesPerLevel)
ResolvableType for arbitrary nesting levelsmapField - the map field to introspectnestingLevel - the nesting level of the target type
(typically 1; e.g. in case of a List of Lists, 1 would indicate the
nested List, whereas 2 would indicate the element of the nested List)typeIndexesPerLevel - Map keyed by nesting level, with each value
expressing the type index for traversal at that levelnull if nonepublic static Class<?> getMapValueFieldType(Field mapField)
mapField - the map field to introspectnull if nonepublic static Class<?> getMapValueFieldType(Field mapField, int nestingLevel)
mapField - the map field to introspectnestingLevel - the nesting level of the target type
(typically 1; e.g. in case of a List of Lists, 1 would indicate the
nested List, whereas 2 would indicate the element of the nested List)null if none@Deprecated public static Class<?> getMapValueFieldType(Field mapField, int nestingLevel, Map<Integer,Integer> typeIndexesPerLevel)
ResolvableType for arbitrary nesting levelsmapField - the map field to introspectnestingLevel - the nesting level of the target type
(typically 1; e.g. in case of a List of Lists, 1 would indicate the
nested List, whereas 2 would indicate the element of the nested List)typeIndexesPerLevel - Map keyed by nesting level, with each value
expressing the type index for traversal at that levelnull if nonepublic static Class<?> getCollectionParameterType(MethodParameter methodParam)
methodParam - the method parameter specificationnull if nonepublic static Class<?> getMapKeyParameterType(MethodParameter methodParam)
methodParam - the method parameter specificationnull if nonepublic static Class<?> getMapValueParameterType(MethodParameter methodParam)
methodParam - the method parameter specificationnull if nonepublic static Class<?> getCollectionReturnType(Method method)
method - the method to check the return type fornull if nonepublic static Class<?> getCollectionReturnType(Method method, int nestingLevel)
If the specified nesting level is higher than 1, the element type of a nested Collection/Map will be analyzed.
method - the method to check the return type fornestingLevel - the nesting level of the target type
(typically 1; e.g. in case of a List of Lists, 1 would indicate the
nested List, whereas 2 would indicate the element of the nested List)null if nonepublic static Class<?> getMapKeyReturnType(Method method)
method - the method to check the return type fornull if nonepublic static Class<?> getMapKeyReturnType(Method method, int nestingLevel)
method - the method to check the return type fornestingLevel - the nesting level of the target type
(typically 1; e.g. in case of a List of Lists, 1 would indicate the
nested List, whereas 2 would indicate the element of the nested List)null if nonepublic static Class<?> getMapValueReturnType(Method method)
method - the method to check the return type fornull if nonepublic static Class<?> getMapValueReturnType(Method method, int nestingLevel)
method - the method to check the return type fornestingLevel - the nesting level of the target type
(typically 1; e.g. in case of a List of Lists, 1 would indicate the
nested List, whereas 2 would indicate the element of the nested List)null if none