类 ParameterizedTypeImpl

  • 所有已实现的接口:
    ParameterizedType, Type

    public class ParameterizedTypeImpl
    extends Object
    implements ParameterizedType
    Implementing class for ParameterizedType interface. 具体请看 sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
    • 方法详细资料

      • make

        public static ParameterizedTypeImpl make​(Class<?> rawType,
                                                 Type[] actualTypeArguments,
                                                 Type ownerType)
        Static factory. Given a (generic) class, actual type arguments and an owner type, creates a parameterized type. This class can be instantiated with a raw type that does not represent a generic type, provided the list of actual type arguments is empty. If the ownerType argument is null, the declaring class of the raw type is used as the owner type.

        This method throws a MalformedParameterizedTypeException under the following circumstances: If the number of actual type arguments (i.e., the size of the array typeArgs) does not correspond to the number of formal type arguments. If any of the actual type arguments is not an instance of the bounds on the corresponding formal.

        参数:
        rawType - the Class representing the generic type declaration being instantiated
        actualTypeArguments - a (possibly empty) array of types representing the actual type arguments to the parameterized type
        ownerType - the enclosing type, if known.
        返回:
        An instance of ParameterizedType
        抛出:
        MalformedParameterizedTypeException - if the instantiation is invalid
      • getActualTypeArguments

        public Type[] getActualTypeArguments()
        Returns an array of Type objects representing the actual type arguments to this type.

        Note that in some cases, the returned array be empty. This can occur if this type represents a non-parameterized type nested within a parameterized type.

        指定者:
        getActualTypeArguments 在接口中 ParameterizedType
        返回:
        an array of Type objects representing the actual type arguments to this type
        抛出:
        TypeNotPresentException - if any of the actual type arguments refers to a non-existent type declaration
        MalformedParameterizedTypeException - if any of the actual type parameters refer to a parameterized type that cannot be instantiated for any reason
        从以下版本开始:
        1.5
      • getRawType

        public Class<?> getRawType()
        Returns the Type object representing the class or interface that declared this type.
        指定者:
        getRawType 在接口中 ParameterizedType
        返回:
        the Type object representing the class or interface that declared this type
      • getOwnerType

        public Type getOwnerType()
        Returns a Type object representing the type that this type is a member of. For example, if this type is O<T>.I<S>, return a representation of O<T>.

        If this type is a top-level type, null is returned.

        指定者:
        getOwnerType 在接口中 ParameterizedType
        返回:
        a Type object representing the type that this type is a member of. If this type is a top-level type, null is returned
        抛出:
        TypeNotPresentException - if the owner type refers to a non-existent type declaration
        MalformedParameterizedTypeException - if the owner type refers to a parameterized type that cannot be instantiated for any reason
      • equals

        public boolean equals​(Object o)
        From the JavaDoc for java.lang.reflect.ParameterizedType "Instances of classes that implement this interface must implement an equals() method that equates any two instances that share the same generic type declaration and have equal type parameters."
        覆盖:
        equals 在类中 Object
      • hashCode

        public int hashCode()
        覆盖:
        hashCode 在类中 Object