类 GenericCollectionTypeResolver


  • @Deprecated
    public abstract class GenericCollectionTypeResolver
    extends Object
    已过时。
    as of 4.3.6, in favor of direct ResolvableType usage
    Helper class for determining element types of collections and maps.

    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).

    从以下版本开始:
    2.0
    作者:
    Juergen Hoeller, Phillip Webb
    另请参阅:
    ResolvableType
    • 方法详细资料

      • getCollectionType

        public 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).
        参数:
        collectionClass - the collection class to introspect
        返回:
        the generic type, or null if none
      • getMapKeyType

        public 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).
        参数:
        mapClass - the map class to introspect
        返回:
        the generic type, or null if none
      • getMapValueType

        public 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).
        参数:
        mapClass - the map class to introspect
        返回:
        the generic type, or null if none
      • getCollectionFieldType

        public static Class<?> getCollectionFieldType​(Field collectionField)
        已过时。
        Determine the generic element type of the given Collection field.
        参数:
        collectionField - the collection field to introspect
        返回:
        the generic type, or null if none
      • getCollectionFieldType

        public static Class<?> getCollectionFieldType​(Field collectionField,
                                                      int nestingLevel)
        已过时。
        Determine the generic element type of the given Collection field.
        参数:
        collectionField - the collection field to introspect
        nestingLevel - 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)
        返回:
        the generic type, or null if none
      • getCollectionFieldType

        @Deprecated
        public static Class<?> getCollectionFieldType​(Field collectionField,
                                                      int nestingLevel,
                                                      Map<Integer,​Integer> typeIndexesPerLevel)
        已过时。
        as of 4.0, in favor of using ResolvableType for arbitrary nesting levels
        Determine the generic element type of the given Collection field.
        参数:
        collectionField - the collection field to introspect
        nestingLevel - 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 level
        返回:
        the generic type, or null if none
      • getMapKeyFieldType

        public static Class<?> getMapKeyFieldType​(Field mapField)
        已过时。
        Determine the generic key type of the given Map field.
        参数:
        mapField - the map field to introspect
        返回:
        the generic type, or null if none
      • getMapKeyFieldType

        public static Class<?> getMapKeyFieldType​(Field mapField,
                                                  int nestingLevel)
        已过时。
        Determine the generic key type of the given Map field.
        参数:
        mapField - the map field to introspect
        nestingLevel - 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)
        返回:
        the generic type, or null if none
      • getMapKeyFieldType

        @Deprecated
        public static Class<?> getMapKeyFieldType​(Field mapField,
                                                  int nestingLevel,
                                                  Map<Integer,​Integer> typeIndexesPerLevel)
        已过时。
        as of 4.0, in favor of using ResolvableType for arbitrary nesting levels
        Determine the generic key type of the given Map field.
        参数:
        mapField - the map field to introspect
        nestingLevel - 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 level
        返回:
        the generic type, or null if none
      • getMapValueFieldType

        public static Class<?> getMapValueFieldType​(Field mapField)
        已过时。
        Determine the generic value type of the given Map field.
        参数:
        mapField - the map field to introspect
        返回:
        the generic type, or null if none
      • getMapValueFieldType

        public static Class<?> getMapValueFieldType​(Field mapField,
                                                    int nestingLevel)
        已过时。
        Determine the generic value type of the given Map field.
        参数:
        mapField - the map field to introspect
        nestingLevel - 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)
        返回:
        the generic type, or null if none
      • getMapValueFieldType

        @Deprecated
        public static Class<?> getMapValueFieldType​(Field mapField,
                                                    int nestingLevel,
                                                    Map<Integer,​Integer> typeIndexesPerLevel)
        已过时。
        as of 4.0, in favor of using ResolvableType for arbitrary nesting levels
        Determine the generic value type of the given Map field.
        参数:
        mapField - the map field to introspect
        nestingLevel - 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 level
        返回:
        the generic type, or null if none
      • getCollectionParameterType

        public static Class<?> getCollectionParameterType​(MethodParameter methodParam)
        已过时。
        Determine the generic element type of the given Collection parameter.
        参数:
        methodParam - the method parameter specification
        返回:
        the generic type, or null if none
      • getMapKeyParameterType

        public static Class<?> getMapKeyParameterType​(MethodParameter methodParam)
        已过时。
        Determine the generic key type of the given Map parameter.
        参数:
        methodParam - the method parameter specification
        返回:
        the generic type, or null if none
      • getMapValueParameterType

        public static Class<?> getMapValueParameterType​(MethodParameter methodParam)
        已过时。
        Determine the generic value type of the given Map parameter.
        参数:
        methodParam - the method parameter specification
        返回:
        the generic type, or null if none
      • getCollectionReturnType

        public static Class<?> getCollectionReturnType​(Method method)
        已过时。
        Determine the generic element type of the given Collection return type.
        参数:
        method - the method to check the return type for
        返回:
        the generic type, or null if none
      • getCollectionReturnType

        public static Class<?> getCollectionReturnType​(Method method,
                                                       int nestingLevel)
        已过时。
        Determine the generic element type of the given Collection return type.

        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 for
        nestingLevel - 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)
        返回:
        the generic type, or null if none
      • getMapKeyReturnType

        public static Class<?> getMapKeyReturnType​(Method method)
        已过时。
        Determine the generic key type of the given Map return type.
        参数:
        method - the method to check the return type for
        返回:
        the generic type, or null if none
      • getMapKeyReturnType

        public static Class<?> getMapKeyReturnType​(Method method,
                                                   int nestingLevel)
        已过时。
        Determine the generic key type of the given Map return type.
        参数:
        method - the method to check the return type for
        nestingLevel - 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)
        返回:
        the generic type, or null if none
      • getMapValueReturnType

        public static Class<?> getMapValueReturnType​(Method method)
        已过时。
        Determine the generic value type of the given Map return type.
        参数:
        method - the method to check the return type for
        返回:
        the generic type, or null if none
      • getMapValueReturnType

        public static Class<?> getMapValueReturnType​(Method method,
                                                     int nestingLevel)
        已过时。
        Determine the generic value type of the given Map return type.
        参数:
        method - the method to check the return type for
        nestingLevel - 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)
        返回:
        the generic type, or null if none