Top Description Fields Constructors Methods
sun.reflect.generics.factory

public Class CoreReflectionFactory

extends Object
implements GenericsFactory
Class Inheritance
All Implemented Interfaces
sun.reflect.generics.factory.GenericsFactory
Imports
java.lang.reflect.Constructor, .GenericDeclaration, .Method, .ParameterizedType, .Type, .TypeVariable, .WildcardType, sun.reflect.generics.reflectiveObjects.*, sun.reflect.generics.scope.Scope, sun.reflect.generics.tree.FieldTypeSignature

Factory for reflective generic type objects for use by core reflection (java.lang.reflect).

Field Summary

Modifier and TypeField and Description
private final GenericDeclaration
private final Scope

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public TypeVariable<?>
findTypeVariable(String
- the name of the type variable to search for
name
)

Implements sun.reflect.generics.factory.GenericsFactory.findTypeVariable.

Returns the type variable with name name, if such a type variable is declared in the scope used to create this factory.
private GenericDeclaration
private ClassLoader
private Scope
public static CoreReflectionFactory

Returns:

an instance of CoreReflectionFactory
make
(GenericDeclaration
- the generic declaration (class, interface, method or constructor) that this factory services
d
,
Scope
the scope in which the factory will allocate and search for type variables
s
)

Factory for this class.

public Type
makeArrayType(Type
- the component type of the array
componentType
)

Implements sun.reflect.generics.factory.GenericsFactory.makeArrayType.

Returns a (possibly generic) array type.
public Type
makeBool()

Implements sun.reflect.generics.factory.GenericsFactory.makeBool.

Returns the reflective representation of type boolean.
public Type
makeByte()

Implements sun.reflect.generics.factory.GenericsFactory.makeByte.

Returns the reflective representation of type byte.
public Type
makeChar()

Implements sun.reflect.generics.factory.GenericsFactory.makeChar.

Returns the reflective representation of type char.
public Type
makeDouble()

Implements sun.reflect.generics.factory.GenericsFactory.makeDouble.

Returns the reflective representation of type double.
public Type
makeFloat()

Implements sun.reflect.generics.factory.GenericsFactory.makeFloat.

Returns the reflective representation of type float.
public Type
makeInt()

Implements sun.reflect.generics.factory.GenericsFactory.makeInt.

Returns the reflective representation of type int.
public Type
makeLong()

Implements sun.reflect.generics.factory.GenericsFactory.makeLong.

Returns the reflective representation of type long.
public Type
public ParameterizedType
makeParameterizedType(Type
- the generic type declaration that is to be instantiated
declaration
,
Type[]
- the list of actual type arguments
typeArgs
,
Type owner)

Implements sun.reflect.generics.factory.GenericsFactory.makeParameterizedType.

Returns an instance of the ParameterizedType interface that corresponds to a generic type instantiation of the generic declaration declaration with actual type arguments typeArgs.
public Type
makeShort()

Implements sun.reflect.generics.factory.GenericsFactory.makeShort.

Returns the reflective representation of type short.
public TypeVariable<?>
makeTypeVariable(String
The name of the type variable
name
,
FieldTypeSignature[]
An array of abstract syntax trees representing the upper bound(s) on the type variable being declared
bounds
)

Implements sun.reflect.generics.factory.GenericsFactory.makeTypeVariable.

Returns a new type variable declaration.
public Type
makeVoid()

Implements sun.reflect.generics.factory.GenericsFactory.makeVoid.

Returns the reflective representation of void.
public WildcardType
makeWildcard(FieldTypeSignature[]
An array of abstract syntax trees representing the upper bound(s) on the type variable being declared
ubs
,
FieldTypeSignature[]
An array of abstract syntax trees representing the lower bound(s) on the type variable being declared
lbs
)

Implements sun.reflect.generics.factory.GenericsFactory.makeWildcard.

Returns a new wildcard type variable.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

declback to summary
private final GenericDeclaration decl
scopeback to summary
private final Scope scope

Constructor Detail

CoreReflectionFactoryback to summary
private CoreReflectionFactory(GenericDeclaration d, Scope s)

Method Detail

findTypeVariableback to summary
public TypeVariable<?> findTypeVariable(String name)

Implements sun.reflect.generics.factory.GenericsFactory.findTypeVariable.

Doc from sun.reflect.generics.factory.GenericsFactory.findTypeVariable.

Returns the type variable with name name, if such a type variable is declared in the scope used to create this factory. Returns null otherwise.

Parameters
name:String

- the name of the type variable to search for

Returns:TypeVariable<?>

- the type variable with name name, or null

getDeclback to summary
private GenericDeclaration getDecl()
getDeclsLoaderback to summary
private ClassLoader getDeclsLoader()
getScopeback to summary
private Scope getScope()
makeback to summary
public static CoreReflectionFactory make(GenericDeclaration d, Scope s)

Factory for this class. Returns an instance of CoreReflectionFactory for the declaration and scope provided. This factory will produce reflective objects of the appropriate kind. Classes produced will be those that would be loaded by the defining class loader of the declaration d (if d is a type declaration, or by the defining loader of the declaring class of d otherwise.

Type variables will be created or lookup as necessary in the scope s.

Parameters
d:GenericDeclaration

- the generic declaration (class, interface, method or constructor) that this factory services

s:Scope

the scope in which the factory will allocate and search for type variables

Returns:CoreReflectionFactory

an instance of CoreReflectionFactory

makeArrayTypeback to summary
public Type makeArrayType(Type componentType)

Implements sun.reflect.generics.factory.GenericsFactory.makeArrayType.

Doc from sun.reflect.generics.factory.GenericsFactory.makeArrayType.

Returns a (possibly generic) array type. If the component type is a parameterized type, it must only have unbounded wildcard arguments, otherwise a MalformedParameterizedTypeException is thrown.

Parameters
componentType:Type

- the component type of the array

Returns:Type

a (possibly generic) array type.

makeBoolback to summary
public Type makeBool()

Implements sun.reflect.generics.factory.GenericsFactory.makeBool.

Doc from sun.reflect.generics.factory.GenericsFactory.makeBool.

Returns the reflective representation of type boolean.

Returns:Type

the reflective representation of type boolean.

makeByteback to summary
public Type makeByte()

Implements sun.reflect.generics.factory.GenericsFactory.makeByte.

Doc from sun.reflect.generics.factory.GenericsFactory.makeByte.

Returns the reflective representation of type byte.

Returns:Type

the reflective representation of type byte.

makeCharback to summary
public Type makeChar()

Implements sun.reflect.generics.factory.GenericsFactory.makeChar.

Doc from sun.reflect.generics.factory.GenericsFactory.makeChar.

Returns the reflective representation of type char.

Returns:Type

the reflective representation of type char.

makeDoubleback to summary
public Type makeDouble()

Implements sun.reflect.generics.factory.GenericsFactory.makeDouble.

Doc from sun.reflect.generics.factory.GenericsFactory.makeDouble.

Returns the reflective representation of type double.

Returns:Type

the reflective representation of type double.

makeFloatback to summary
public Type makeFloat()

Implements sun.reflect.generics.factory.GenericsFactory.makeFloat.

Doc from sun.reflect.generics.factory.GenericsFactory.makeFloat.

Returns the reflective representation of type float.

Returns:Type

the reflective representation of type float.

makeIntback to summary
public Type makeInt()

Implements sun.reflect.generics.factory.GenericsFactory.makeInt.

Doc from sun.reflect.generics.factory.GenericsFactory.makeInt.

Returns the reflective representation of type int.

Returns:Type

the reflective representation of type int.

makeLongback to summary
public Type makeLong()

Implements sun.reflect.generics.factory.GenericsFactory.makeLong.

Doc from sun.reflect.generics.factory.GenericsFactory.makeLong.

Returns the reflective representation of type long.

Returns:Type

the reflective representation of type long.

makeNamedTypeback to summary
public Type makeNamedType(String name)

Implements sun.reflect.generics.factory.GenericsFactory.makeNamedType.

makeParameterizedTypeback to summary
public ParameterizedType makeParameterizedType(Type declaration, Type[] typeArgs, Type owner)

Implements sun.reflect.generics.factory.GenericsFactory.makeParameterizedType.

Doc from sun.reflect.generics.factory.GenericsFactory.makeParameterizedType.

Returns an instance of the ParameterizedType interface that corresponds to a generic type instantiation of the generic declaration declaration with actual type arguments typeArgs. If owner is null, the declaring class of declaration is used as the owner of this parameterized type.

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.

Parameters
declaration:Type

- the generic type declaration that is to be instantiated

typeArgs:Type[]

- the list of actual type arguments

Returns:ParameterizedType

- a parameterized type representing the instantiation of the declaration with the actual type arguments

makeShortback to summary
public Type makeShort()

Implements sun.reflect.generics.factory.GenericsFactory.makeShort.

Doc from sun.reflect.generics.factory.GenericsFactory.makeShort.

Returns the reflective representation of type short.

Returns:Type

the reflective representation of type short.

makeTypeVariableback to summary
public TypeVariable<?> makeTypeVariable(String name, FieldTypeSignature[] bounds)

Implements sun.reflect.generics.factory.GenericsFactory.makeTypeVariable.

Doc from sun.reflect.generics.factory.GenericsFactory.makeTypeVariable.

Returns a new type variable declaration. Note that name may be empty (but not null). If bounds is empty, a bound of java.lang.Object is used.

Parameters
name:String

The name of the type variable

bounds:FieldTypeSignature[]

An array of abstract syntax trees representing the upper bound(s) on the type variable being declared

Returns:TypeVariable<?>

a new type variable declaration

makeVoidback to summary
public Type makeVoid()

Implements sun.reflect.generics.factory.GenericsFactory.makeVoid.

Doc from sun.reflect.generics.factory.GenericsFactory.makeVoid.

Returns the reflective representation of void.

Returns:Type

the reflective representation of void.

makeWildcardback to summary
public WildcardType makeWildcard(FieldTypeSignature[] ubs, FieldTypeSignature[] lbs)

Implements sun.reflect.generics.factory.GenericsFactory.makeWildcard.

Doc from sun.reflect.generics.factory.GenericsFactory.makeWildcard.

Returns a new wildcard type variable. If ubs is empty, a bound of java.lang.Object is used.

Parameters
ubs:FieldTypeSignature[]

An array of abstract syntax trees representing the upper bound(s) on the type variable being declared

lbs:FieldTypeSignature[]

An array of abstract syntax trees representing the lower bound(s) on the type variable being declared

Returns:WildcardType

a new wildcard type variable