aicas logo Jamaica 3.4 release 8

sun.reflect.generics.factory
Class CoreReflectionFactory

java.lang.Object
  extended by sun.reflect.generics.factory.CoreReflectionFactory
All Implemented Interfaces:
GenericsFactory

public class CoreReflectionFactory
extends Object
implements GenericsFactory

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


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.
static CoreReflectionFactory make(GenericDeclaration d, Scope s)
          Factory for this class.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

make

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 - - the generic declaration (class, interface, method or constructor) that thsi factory services
s - the scope in which the factory will allocate and search for type variables
Returns:
an instance of CoreReflectionFactory

makeTypeVariable

public TypeVariable<?> makeTypeVariable(String name,
                                        FieldTypeSignature[] bounds)
Description copied from interface: GenericsFactory
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.

Specified by:
makeTypeVariable in interface GenericsFactory
Parameters:
name - The name of the type variable
bounds - An array of abstract syntax trees representing the upper bound(s) on the type variable being declared
Returns:
a new type variable declaration

makeWildcard

public WildcardType makeWildcard(FieldTypeSignature[] ubs,
                                 FieldTypeSignature[] lbs)
Description copied from interface: GenericsFactory
Returns a new wildcard type variable. If ubs is empty, a bound of java.lang.Object is used.

Specified by:
makeWildcard in interface GenericsFactory
Parameters:
ubs - An array of abstract syntax trees representing the upper bound(s) on the type variable being declared
lbs - An array of abstract syntax trees representing the lower bound(s) on the type variable being declared
Returns:
a new wildcard type variable

makeParameterizedType

public ParameterizedType makeParameterizedType(Type declaration,
                                               Type[] typeArgs,
                                               Type owner)
Description copied from interface: GenericsFactory
Return 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.

Specified by:
makeParameterizedType in interface GenericsFactory
Parameters:
declaration - - the generic type declaration that is to be instantiated
typeArgs - - the list of actual type arguments
Returns:
- a parameterized type representing the instantiation of the declaration with the actual type arguments

findTypeVariable

public TypeVariable<?> findTypeVariable(String name)
Description copied from interface: GenericsFactory
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.

Specified by:
findTypeVariable in interface GenericsFactory
Parameters:
name - - the name of the type variable to search for
Returns:
- the type variable with name name, or null

makeNamedType

public Type makeNamedType(String name)
Specified by:
makeNamedType in interface GenericsFactory

makeArrayType

public Type makeArrayType(Type componentType)
Description copied from interface: GenericsFactory
Returns a (possibly generic) array type. If the component type is a parameterized type, it must only have unbounded wildcard arguemnts, otherwise a MalformedParameterizedTypeException is thrown.

Specified by:
makeArrayType in interface GenericsFactory
Parameters:
componentType - - the component type of the array
Returns:
a (possibly generic) array type.

makeByte

public Type makeByte()
Description copied from interface: GenericsFactory
Returns the reflective representation of type byte.

Specified by:
makeByte in interface GenericsFactory
Returns:
the reflective representation of type byte.

makeBool

public Type makeBool()
Description copied from interface: GenericsFactory
Returns the reflective representation of type boolean.

Specified by:
makeBool in interface GenericsFactory
Returns:
the reflective representation of type boolean.

makeShort

public Type makeShort()
Description copied from interface: GenericsFactory
Returns the reflective representation of type short.

Specified by:
makeShort in interface GenericsFactory
Returns:
the reflective representation of type short.

makeChar

public Type makeChar()
Description copied from interface: GenericsFactory
Returns the reflective representation of type char.

Specified by:
makeChar in interface GenericsFactory
Returns:
the reflective representation of type char.

makeInt

public Type makeInt()
Description copied from interface: GenericsFactory
Returns the reflective representation of type int.

Specified by:
makeInt in interface GenericsFactory
Returns:
the reflective representation of type int.

makeLong

public Type makeLong()
Description copied from interface: GenericsFactory
Returns the reflective representation of type long.

Specified by:
makeLong in interface GenericsFactory
Returns:
the reflective representation of type long.

makeFloat

public Type makeFloat()
Description copied from interface: GenericsFactory
Returns the reflective representation of type float.

Specified by:
makeFloat in interface GenericsFactory
Returns:
the reflective representation of type float.

makeDouble

public Type makeDouble()
Description copied from interface: GenericsFactory
Returns the reflective representation of type double.

Specified by:
makeDouble in interface GenericsFactory
Returns:
the reflective representation of type double.

makeVoid

public Type makeVoid()
Description copied from interface: GenericsFactory
Returns the reflective representation of void.

Specified by:
makeVoid in interface GenericsFactory
Returns:
the reflective representation of void.

aicas logo Jamaica 3.4 release 8

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2009 aicas GmbH. All Rights Reserved.