|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface GenericsFactory
A factory interface for reflective objects representing generic types. Implementors (such as core reflection or JDI, or possibly javadoc will manufacture instances of (potentially) different classes in response to invocations of the methods described here.
The intent is that reflective systems use these factories to produce generic type information on demand. Certain components of such reflective systems can be independent of a specific implementation by using this interface. For example, repositories of generic type information are initialized with a factory conforming to this interface, and use it to generate the tpe information they are required to provide. As a result, such repository code can be shared across different reflective systems.
| Method Summary | |
|---|---|
TypeVariable<?> |
findTypeVariable(String name)
Returns the type variable with name name, if such a type variable is declared in the scope used to create this factory. |
Type |
makeArrayType(Type componentType)
Returns a (possibly generic) array type. |
Type |
makeBool()
Returns the reflective representation of type boolean. |
Type |
makeByte()
Returns the reflective representation of type byte. |
Type |
makeChar()
Returns the reflective representation of type char. |
Type |
makeDouble()
Returns the reflective representation of type double. |
Type |
makeFloat()
Returns the reflective representation of type float. |
Type |
makeInt()
Returns the reflective representation of type int. |
Type |
makeLong()
Returns the reflective representation of type long. |
Type |
makeNamedType(String name)
|
ParameterizedType |
makeParameterizedType(Type declaration,
Type[] typeArgs,
Type owner)
Return an instance of the ParameterizedType interface that corresponds to a generic type instantiation of the generic declaration declaration with actual type arguments typeArgs. |
Type |
makeShort()
Returns the reflective representation of type short. |
TypeVariable<?> |
makeTypeVariable(String name,
FieldTypeSignature[] bounds)
Returns a new type variable declaration. |
Type |
makeVoid()
Returns the reflective representation of void. |
WildcardType |
makeWildcard(FieldTypeSignature[] ubs,
FieldTypeSignature[] lbs)
Returns a new wildcard type variable. |
| Method Detail |
|---|
TypeVariable<?> makeTypeVariable(String name,
FieldTypeSignature[] bounds)
name - The name of the type variablebounds - An array of abstract syntax trees representing
the upper bound(s) on the type variable being declared
NullPointerException - - if any of the actual parameters
or any of the elements of bounds are null.
ParameterizedType makeParameterizedType(Type declaration,
Type[] typeArgs,
Type owner)
This method throws a MalformedParameterizedTypeException under the following circumstances: If the type declaration does not represent a generic declaration (i.e., it is not an instance of GenericDeclaration). 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.
declaration - - the generic type declaration that is to be
instantiatedtypeArgs - - the list of actual type arguments
MalformedParameterizedTypeException - - if the instantiation
is invalid
NullPointerException - - if any of declaration
, typeArgs
or any of the elements of typeArgs are nullTypeVariable<?> findTypeVariable(String name)
name - - the name of the type variable to search for
NullPointerException - - if any of actual parameters are
null
WildcardType makeWildcard(FieldTypeSignature[] ubs,
FieldTypeSignature[] lbs)
ubs - An array of abstract syntax trees representing
the upper bound(s) on the type variable being declaredlbs - An array of abstract syntax trees representing
the lower bound(s) on the type variable being declared
NullPointerException - - if any of the actual parameters
or any of the elements of ubs or lbsare
nullType makeNamedType(String name)
Type makeArrayType(Type componentType)
componentType - - the component type of the array
MalformedParameterizedTypeException - if componentType
is a parameterized type with non-wildcard type arguments
NullPointerException - - if any of the actual parameters
are nullType makeByte()
Type makeBool()
Type makeShort()
Type makeChar()
Type makeInt()
Type makeLong()
Type makeFloat()
Type makeDouble()
Type makeVoid()
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||