java.lang.reflect
Interface TypeVariable
- All Superinterfaces:
- Type
- All Known Subinterfaces:
- ClassTypeVariable, MethodTypeVariable
- public interface TypeVariable
- extends Type
The TypeVariable
interface represents a type variable
declared as a formal parameter to a generic class, interface or method.
Example: A
in Collection<A>
.
This interface embodies commonality among all type variables.
Every actual type variable supports one of the two subinterfaces
MethodTypeVariable
or ClassTypeVariable
.
Note that implementations of this interface are free to return
distinct objects for the same type variable; the identity of
objects implementing this interface may not be used to test for identity
among the type variables they represent.
Method Summary |
Type[] |
getBounds()
Returns an array with Type objects representing the
declared bound(s) of the type variable represented by
this object. |
java.lang.String |
getName()
Returns the name of this type variable. |
getBounds
public Type[] getBounds()
- Returns an array with
Type
objects representing the
declared bound(s) of the type variable represented by
this object. If no bound is explicitly declared, than
the array contains one element, a Class
object
representing java.lang.Object
.
- Returns:
- the declared bounds for this type variable
getName
public java.lang.String getName()
- Returns the name of this type variable.
- Returns:
- the name of the type variable represented by this object