Class ParameterizedTypeImpl
- java.lang.Object
-
- io.microsphere.reflect.generics.ParameterizedTypeImpl
-
- All Implemented Interfaces:
java.lang.reflect.ParameterizedType,java.lang.reflect.Type
public class ParameterizedTypeImpl extends java.lang.Object implements java.lang.reflect.ParameterizedTypeParameterizedTypeImplementation forkssun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
ParameterizedType,sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)java.lang.reflect.Type[]getActualTypeArguments()Returns an array of Type objects representing the actual type arguments to this type.java.lang.reflect.TypegetOwnerType()Returns a Type object representing the type that this type is a member of.java.lang.Class<?>getRawType()Returns the Type object representing the class or interface that declared this type.inthashCode()static ParameterizedTypeImplof(java.lang.Class<?> rawType, java.lang.reflect.Type... actualTypeArguments)Static factory.static ParameterizedTypeImplof(java.lang.Class<?> rawType, java.lang.reflect.Type[] actualTypeArguments, java.lang.reflect.Type ownerType)Static factory.java.lang.StringtoString()
-
-
-
Method Detail
-
of
public static ParameterizedTypeImpl of(java.lang.Class<?> rawType, java.lang.reflect.Type... actualTypeArguments)
Static factory. Given a (generic) class, actual type arguments and an owner type, creates a parameterized type. This class can be instantiated with a 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.
- Parameters:
rawType- the Class representing the generic type declaration being instantiatedactualTypeArguments- - a (possibly empty) array of types representing the actual type arguments to the parameterized type- Returns:
- An instance of ParameterizedType
- Throws:
java.lang.reflect.MalformedParameterizedTypeException- - if the instantiation is invalid
-
of
public static ParameterizedTypeImpl of(java.lang.Class<?> rawType, java.lang.reflect.Type[] actualTypeArguments, java.lang.reflect.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 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.
- Parameters:
rawType- the Class representing the generic type declaration being instantiatedactualTypeArguments- - a (possibly empty) array of types representing the actual type arguments to the parameterized typeownerType- - the enclosing type, if known.- Returns:
- An instance of ParameterizedType
- Throws:
java.lang.reflect.MalformedParameterizedTypeException- - if the instantiation is invalid
-
getActualTypeArguments
public java.lang.reflect.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.
- Specified by:
getActualTypeArgumentsin interfacejava.lang.reflect.ParameterizedType- Returns:
- an array of Type objects representing the actual type arguments to this type
- Since:
- 1.5
-
getRawType
public java.lang.Class<?> getRawType()
Returns the Type object representing the class or interface that declared this type.- Specified by:
getRawTypein interfacejava.lang.reflect.ParameterizedType- Returns:
- the Type object representing the class or interface that declared this type
-
getOwnerType
public java.lang.reflect.Type getOwnerType()
Returns a Type object representing the type that this type is a member of. For example, if this type is O.I , return a representation of O. If this type is a top-level type, null is returned.
- Specified by:
getOwnerTypein interfacejava.lang.reflect.ParameterizedType- Returns:
- a Type object representing the type that this type is a member of. If this type is a top-level type, null is returned
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-