org.jboss.reflect.plugins.introspection
Class IntrospectionTypeInfoFactoryImpl

java.lang.Object
  extended by org.jboss.util.collection.WeakTypeCache<TypeInfo>
      extended by org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactoryImpl
All Implemented Interfaces:
AnnotationHelper, ClassInfoHelper, TypeInfoFactory

public class IntrospectionTypeInfoFactoryImpl
extends org.jboss.util.collection.WeakTypeCache<TypeInfo>
implements TypeInfoFactory, AnnotationHelper, ClassInfoHelper

An introspection type factory.

Author:
Adrian Brock

Constructor Summary
IntrospectionTypeInfoFactoryImpl()
           
 
Method Summary
 AnnotationValue createAnnotationValue(AnnotationInfo info, Object ann)
          Create an annotation from the underlying implementation and its info type
protected  TypeInfo findActualType(ClassInfo classInfo, Class<?> reference, int parameter)
           
protected  void generate(Class<?> clazz, TypeInfo result)
           
protected  void generate(ParameterizedType type, TypeInfo result)
           
 void generateTypeInfo(Class<?> clazz, ClassInfoImpl info)
          Generate the type info for a class
 TypeInfo[] getActualTypeArguments(ParameterizedClassInfo classInfo)
          Get the actual type parameters
 AnnotationValue[] getAnnotations(Object obj)
          Get the annotations for the annotated object
 ClassInfo[] getClassInfos(Type[] classes)
          Get the class infos for some classes
 TypeInfo getComponentType(ClassInfo classInfo)
          Get the component type for a collection
 ConstructorInfoImpl[] getConstructors(ClassInfoImpl classInfo)
          Get the constructors
protected  Constructor<?>[] getDeclaredConstructors(Class<?> clazz)
           
protected  Field[] getDeclaredFields(Class<?> clazz)
           
protected  Method[] getDeclaredMethods(Class<?> clazz)
           
 FieldInfoImpl[] getFields(ClassInfoImpl classInfo)
          Get the fields
protected  TypeInfo getGenericArrayType(GenericArrayType type)
          Get the information for an array type
 InterfaceInfo[] getGenericInterfaces(ClassInfoImpl classInfo)
          Get the generic interfaces
 ClassInfo getGenericSuperClass(ClassInfoImpl classInfo)
          Get the generic super class
 InterfaceInfo[] getInterfaces(ClassInfoImpl classInfo)
          Get the interfaces
 TypeInfo getKeyType(ClassInfo classInfo)
          Get the key type for a map
 MethodInfoImpl[] getMethods(ClassInfoImpl classInfo)
          Get the methods
 TypeInfo getOwnerType(ParameterizedClassInfo classInfo)
          Get the owner type
 PackageInfoImpl getPackage(ClassInfoImpl classInfo)
          Get the package for class
protected  AnnotationValue[][] getParameterAnnotations(Annotation[][] annotations)
           
 ClassInfoImpl getSuperClass(ClassInfoImpl classInfo)
          Get the super class
 TypeInfo getTypeInfo(Class<?> clazz)
          Get a type info
 TypeInfo getTypeInfo(String name, ClassLoader cl)
          Get a type info
 TypeInfo getTypeInfo(Type type)
          Get a type info
 TypeInfo[] getTypeInfos(Type[] classes)
          Get the type infos for some classes
 TypeInfo getValueType(ClassInfo classInfo)
          Get the value type for a map
protected  TypeInfo instantiate(Class<?> clazz)
           
protected  TypeInfo instantiate(ParameterizedType type)
           
protected static Type locateActualType(Class reference, int parameter, Class clazz, Type type)
           
protected  TypeInfo resolveComplexTypeInfo(ClassLoader cl, String name)
          Resolve complex type info.
 
Methods inherited from class org.jboss.util.collection.WeakTypeCache
get, get, getClass, getClassLoaderCache, getParameterizedType, getTypeVariable, getWildcardType, peek, peek, put, put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntrospectionTypeInfoFactoryImpl

public IntrospectionTypeInfoFactoryImpl()
Method Detail

generateTypeInfo

public void generateTypeInfo(Class<?> clazz,
                             ClassInfoImpl info)
Generate the type info for a class

Parameters:
clazz - the class
info - the class info

getSuperClass

public ClassInfoImpl getSuperClass(ClassInfoImpl classInfo)
Description copied from interface: ClassInfoHelper
Get the super class

Specified by:
getSuperClass in interface ClassInfoHelper
Parameters:
classInfo - the class info
Returns:
the super class info

getGenericSuperClass

public ClassInfo getGenericSuperClass(ClassInfoImpl classInfo)
Description copied from interface: ClassInfoHelper
Get the generic super class

Specified by:
getGenericSuperClass in interface ClassInfoHelper
Parameters:
classInfo - the class info
Returns:
the super class info

getAnnotations

public AnnotationValue[] getAnnotations(Object obj)
Description copied from interface: AnnotationHelper
Get the annotations for the annotated object

Specified by:
getAnnotations in interface AnnotationHelper
Parameters:
obj - the annotated object
Returns:
the annotations

createAnnotationValue

public AnnotationValue createAnnotationValue(AnnotationInfo info,
                                             Object ann)
Description copied from interface: AnnotationHelper
Create an annotation from the underlying implementation and its info type

Specified by:
createAnnotationValue in interface AnnotationHelper
Parameters:
info - the annotation info
ann - the underlying annotation
Returns:
the annotation value

getConstructors

public ConstructorInfoImpl[] getConstructors(ClassInfoImpl classInfo)
Description copied from interface: ClassInfoHelper
Get the constructors

Specified by:
getConstructors in interface ClassInfoHelper
Parameters:
classInfo - the class info
Returns:
the constructor info

getFields

public FieldInfoImpl[] getFields(ClassInfoImpl classInfo)
Description copied from interface: ClassInfoHelper
Get the fields

Specified by:
getFields in interface ClassInfoHelper
Parameters:
classInfo - the class info
Returns:
the field info

getMethods

public MethodInfoImpl[] getMethods(ClassInfoImpl classInfo)
Description copied from interface: ClassInfoHelper
Get the methods

Specified by:
getMethods in interface ClassInfoHelper
Parameters:
classInfo - the class info
Returns:
the method info

getInterfaces

public InterfaceInfo[] getInterfaces(ClassInfoImpl classInfo)
Description copied from interface: ClassInfoHelper
Get the interfaces

Specified by:
getInterfaces in interface ClassInfoHelper
Parameters:
classInfo - the class info
Returns:
the interface info

getGenericInterfaces

public InterfaceInfo[] getGenericInterfaces(ClassInfoImpl classInfo)
Description copied from interface: ClassInfoHelper
Get the generic interfaces

Specified by:
getGenericInterfaces in interface ClassInfoHelper
Parameters:
classInfo - the class info
Returns:
the interface info

getPackage

public PackageInfoImpl getPackage(ClassInfoImpl classInfo)
Description copied from interface: ClassInfoHelper
Get the package for class

Specified by:
getPackage in interface ClassInfoHelper
Parameters:
classInfo - the class info
Returns:
the package

getTypeInfos

public TypeInfo[] getTypeInfos(Type[] classes)
Get the type infos for some classes

Parameters:
classes - the classes
Returns:
the type infos

getClassInfos

public ClassInfo[] getClassInfos(Type[] classes)
Get the class infos for some classes

Parameters:
classes - the classes
Returns:
the class infos

getTypeInfo

public TypeInfo getTypeInfo(Class<?> clazz)
Description copied from interface: TypeInfoFactory
Get a type info

Specified by:
getTypeInfo in interface ClassInfoHelper
Specified by:
getTypeInfo in interface TypeInfoFactory
Parameters:
clazz - the class
Returns:
the type info

getTypeInfo

public TypeInfo getTypeInfo(Type type)
Description copied from interface: TypeInfoFactory
Get a type info

Specified by:
getTypeInfo in interface TypeInfoFactory
Parameters:
type - the type
Returns:
the type info

getTypeInfo

public TypeInfo getTypeInfo(String name,
                            ClassLoader cl)
                     throws ClassNotFoundException
Description copied from interface: TypeInfoFactory
Get a type info

Specified by:
getTypeInfo in interface TypeInfoFactory
Parameters:
name - the class name
cl - the classloader
Returns:
the type info
Throws:
ClassNotFoundException - when there is no such class

getGenericArrayType

protected TypeInfo getGenericArrayType(GenericArrayType type)
Get the information for an array type

Overrides:
getGenericArrayType in class org.jboss.util.collection.WeakTypeCache<TypeInfo>
Parameters:
type - the array type
Returns:
the info

resolveComplexTypeInfo

protected TypeInfo resolveComplexTypeInfo(ClassLoader cl,
                                          String name)
                                   throws ClassNotFoundException
Resolve complex type info.

Parameters:
cl - the classloader to use
name - the class name
Returns:
type info from the name and classloader
Throws:
ClassNotFoundException - for any error

instantiate

protected TypeInfo instantiate(Class<?> clazz)
Specified by:
instantiate in class org.jboss.util.collection.WeakTypeCache<TypeInfo>

instantiate

protected TypeInfo instantiate(ParameterizedType type)
Specified by:
instantiate in class org.jboss.util.collection.WeakTypeCache<TypeInfo>

generate

protected void generate(Class<?> clazz,
                        TypeInfo result)
Specified by:
generate in class org.jboss.util.collection.WeakTypeCache<TypeInfo>

generate

protected void generate(ParameterizedType type,
                        TypeInfo result)
Specified by:
generate in class org.jboss.util.collection.WeakTypeCache<TypeInfo>

getDeclaredConstructors

protected Constructor<?>[] getDeclaredConstructors(Class<?> clazz)

getDeclaredFields

protected Field[] getDeclaredFields(Class<?> clazz)

getDeclaredMethods

protected Method[] getDeclaredMethods(Class<?> clazz)

getParameterAnnotations

protected AnnotationValue[][] getParameterAnnotations(Annotation[][] annotations)

getActualTypeArguments

public TypeInfo[] getActualTypeArguments(ParameterizedClassInfo classInfo)
Description copied from interface: ClassInfoHelper
Get the actual type parameters

Specified by:
getActualTypeArguments in interface ClassInfoHelper
Parameters:
classInfo - the parameterized class info
Returns:
the type parameters

getOwnerType

public TypeInfo getOwnerType(ParameterizedClassInfo classInfo)
Description copied from interface: ClassInfoHelper
Get the owner type

Specified by:
getOwnerType in interface ClassInfoHelper
Parameters:
classInfo - the parameterized class info
Returns:
the owner type

getComponentType

public TypeInfo getComponentType(ClassInfo classInfo)
Description copied from interface: ClassInfoHelper
Get the component type for a collection

Specified by:
getComponentType in interface ClassInfoHelper
Parameters:
classInfo - the class info
Returns:
the component type or null if not a collection

getKeyType

public TypeInfo getKeyType(ClassInfo classInfo)
Description copied from interface: ClassInfoHelper
Get the key type for a map

Specified by:
getKeyType in interface ClassInfoHelper
Parameters:
classInfo - the class info
Returns:
the key type or null if not a map

getValueType

public TypeInfo getValueType(ClassInfo classInfo)
Description copied from interface: ClassInfoHelper
Get the value type for a map

Specified by:
getValueType in interface ClassInfoHelper
Parameters:
classInfo - the class info
Returns:
the value type or null if not a map

findActualType

protected TypeInfo findActualType(ClassInfo classInfo,
                                  Class<?> reference,
                                  int parameter)

locateActualType

protected static Type locateActualType(Class reference,
                                       int parameter,
                                       Class clazz,
                                       Type type)


Copyright © 2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.