APIdia Launch Partner
Top Description Fields Constructors Methods
sun.reflect.generics.reflectiveObjects

public Class ParameterizedTypeImpl

extends Object
implements ParameterizedType
Class Inheritance
All Implemented Interfaces
java.lang.reflect.ParameterizedType, java.lang.reflect.Type
Imports
java.lang.reflect.MalformedParameterizedTypeException, .ParameterizedType, .Type, .TypeVariable, java.util.Arrays, .StringJoiner, .Objects

Implementing class for ParameterizedType interface.

Field Summary

Modifier and TypeField and Description
private final Type[]
private final Type
private final Class<?>

Constructor Summary

AccessConstructor and Description
private
ParameterizedTypeImpl(Class<?> rawType, Type[] actualTypeArguments, Type ownerType)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object o)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public Type[]

Returns:

an array of Type objects representing the actual type arguments to this type
getActualTypeArguments
()

Implements java.lang.reflect.ParameterizedType.getActualTypeArguments.

Returns an array of Type objects representing the actual type arguments to this type.

public Type

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
getOwnerType
()

Implements java.lang.reflect.ParameterizedType.getOwnerType.

Returns a Type object representing the type that this type is a member of.

public Class<?>

Returns:

the Type object representing the class or interface that declared this type
getRawType
()

Implements java.lang.reflect.ParameterizedType.getRawType.

Returns the Type object representing the class or interface that declared this type.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public static ParameterizedTypeImpl

Returns:

An instance of ParameterizedType
make
(Class<?>
the Class representing the generic type declaration being instantiated
rawType
,
Type[]
a (possibly empty) array of types representing the actual type arguments to the parameterized type
actualTypeArguments
,
Type
the enclosing type, if known.
ownerType
)

Static factory.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

private void
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

actualTypeArgumentsback to summary
private final Type[] actualTypeArguments
ownerTypeback to summary
private final Type ownerType
rawTypeback to summary
private final Class<?> rawType

Constructor Detail

ParameterizedTypeImplback to summary
private ParameterizedTypeImpl(Class<?> rawType, Type[] actualTypeArguments, Type ownerType)

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
getActualTypeArgumentsback to summary
public Type[] getActualTypeArguments()

Implements java.lang.reflect.ParameterizedType.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.

Returns:Type[]

an array of Type objects representing the actual type arguments to this type

Exceptions
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
Since
1.5
getOwnerTypeback to summary
public Type getOwnerType()

Implements java.lang.reflect.ParameterizedType.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.

Returns:Type

a Type object representing the type that this type is a member of. If this type is a top-level type, null is returned

Exceptions
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
getRawTypeback to summary
public Class<?> getRawType()

Implements java.lang.reflect.ParameterizedType.getRawType.

Returns the Type object representing the class or interface that declared this type.

Returns:Class<?>

the Type object representing the class or interface that declared this type

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
makeback to summary
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.

Parameters
rawType:Class<?>

the Class representing the generic type declaration being instantiated

actualTypeArguments:Type[]

a (possibly empty) array of types representing the actual type arguments to the parameterized type

ownerType:Type

the enclosing type, if known.

Returns:ParameterizedTypeImpl

An instance of ParameterizedType

Exceptions
MalformedParameterizedTypeException:
if the instantiation is invalid
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

validateConstructorArgumentsback to summary
private void validateConstructorArguments()