public class JavassistTypeInfoFactoryImpl extends org.jboss.util.collection.WeakClassCache<TypeInfo> implements MutableTypeInfoFactory, AnnotationHelper
Modifier and Type | Class and Description |
---|---|
protected static class |
JavassistTypeInfoFactoryImpl.ModifiableArrayType
Wrapper around
SignatureAttribute.ArrayType to make it easier to
create the name used to look up the array type infos
in the cache |
Modifier and Type | Method and Description |
---|---|
protected static String |
convertName(javassist.CtClass clazz)
Convert name
|
AnnotationValue |
createAnnotationValue(AnnotationInfo info,
Object ann)
Create an annotation from the underlying implementation and its info type
|
MutableClassInfo |
createNewMutableClass(String name)
Creates a new MutableClass.
|
MutableClassInfo |
createNewMutableClass(String name,
ClassInfo superClass)
Creates a new MutableClass.
|
MutableClassInfo |
createNewMutableInterface(String name)
Creates a new mutable interface.
|
MutableClassInfo |
createNewMutableInterface(String name,
ClassInfo superClass)
Creates a new mutable interface.
|
protected TypeInfo |
createTypeInfoForTypeArgument(javassist.bytecode.SignatureAttribute.TypeArgument arg,
ClassLoader loader,
org.jboss.reflect.plugins.javassist.JavassistTypeVariableSpy spy)
Gets the type info for a javassist type argument
|
protected void |
generate(Class clazz,
TypeInfo result) |
TypeInfo |
get(Class clazz)
Get the information for a class
|
protected TypeInfo |
get(javassist.CtClass ctClass)
Get the information for a class
|
protected TypeInfo |
get(javassist.CtClass ctClass,
Class<?> clazz,
String name,
ClassLoader cl,
boolean delegateToReflectIfNotFound)
Get the information for a class
|
TypeInfo |
get(String name,
ClassLoader cl)
Get the information for a class
|
protected TypeInfo |
get(String name,
ClassLoader cl,
Class<?> clazz)
Get the information for a class
|
AnnotationValue[] |
getAnnotations(Object obj)
Get the annotations for the annotated object
|
protected Map<String,WeakReference<TypeInfo>> |
getClassLoaderCache(ClassLoader cl)
Gets the classloader cache for the passed in classloader.
|
protected javassist.CtClass |
getCtClass(String name)
Gets the CtClass corresponding to
name by using the bootstrap class pool. |
protected javassist.CtClass |
getCtClass(String name,
ClassLoader classLoader)
Gets the CtClass corresponding to
name . |
protected ArrayInfo |
getGenericArrayType(ClassLoader cl,
JavassistTypeInfoFactoryImpl.ModifiableArrayType type,
org.jboss.reflect.plugins.javassist.JavassistTypeVariableSpy spy)
Recursively get the type info for a javassist array type
|
protected ArrayInfo |
getGenericArrayType(ClassLoader cl,
javassist.bytecode.SignatureAttribute.ArrayType type,
org.jboss.reflect.plugins.javassist.JavassistTypeVariableSpy spy)
Get the type info for a javassist array type
|
protected TypeInfo |
getGenericArrayType(GenericArrayType type)
Get the type info for a reflect generic array type
|
MutableClassInfo |
getMutable(String name,
ClassLoader cl)
Gets the information for a MutableClass.
|
protected TypeInfo |
getParameterizedType(ParameterizedType type)
Creates a type info from a reflect generic paramemeterized type
|
static ClassPoolFactory |
getPoolFactory() |
TypeInfo |
getTypeInfo(Class<?> clazz)
Get a type info
|
protected TypeInfo |
getTypeInfo(ClassLoader loader,
javassist.bytecode.SignatureAttribute.ClassType type,
org.jboss.reflect.plugins.javassist.JavassistTypeVariableSpy spy)
Gets the type info for a javassist generic class type
|
protected TypeInfo |
getTypeInfo(ClassLoader loader,
javassist.bytecode.SignatureAttribute.Type type,
org.jboss.reflect.plugins.javassist.JavassistTypeVariableSpy spy)
Gets the type info for a javassist type
|
protected TypeInfo |
getTypeInfo(javassist.CtClass ctClass)
Get the type info
|
TypeInfo |
getTypeInfo(String name,
ClassLoader cl)
Gets the type info for a class
|
TypeInfo |
getTypeInfo(Type type)
Gets the type info for a reflect type
|
protected TypeInfo |
getTypeVariable(TypeVariable<?> type)
Get the type info for a reflect TypeVariable
|
protected TypeInfo |
getWildcardType(WildcardType type)
Gets the type info for a reflect wildcard type
|
protected TypeInfo |
instantiate(Class clazz) |
protected TypeInfo |
instantiate(javassist.CtClass ctClass,
Class<?> clazz) |
static NoClassDefFoundError |
raiseClassNotFound(String name,
ClassNotFoundException e)
Raise NoClassDefFoundError for javassist not found
|
static NoClassDefFoundError |
raiseClassNotFound(String name,
javassist.NotFoundException e)
Raise NoClassDefFoundError for javassist not found
|
static NoClassDefFoundError |
raiseFieldNotFound(String name,
javassist.NotFoundException e)
Raise NoClassDefFoundError for javassist not found
|
static NoClassDefFoundError |
raiseMethodNotFound(String name,
javassist.NotFoundException e)
Raise NoClassDefFoundError for javassist not found
|
static void |
setPoolFactory(ClassPoolFactory classPoolFactory) |
public static ClassPoolFactory getPoolFactory()
public static void setPoolFactory(ClassPoolFactory classPoolFactory)
public static NoClassDefFoundError raiseClassNotFound(String name, javassist.NotFoundException e) throws NoClassDefFoundError
name
- the namee
- the not found errorNoClassDefFoundError
- alwayspublic static NoClassDefFoundError raiseClassNotFound(String name, ClassNotFoundException e) throws NoClassDefFoundError
name
- the namee
- the not found errorNoClassDefFoundError
- alwayspublic static NoClassDefFoundError raiseMethodNotFound(String name, javassist.NotFoundException e) throws NoClassDefFoundError
name
- the namee
- the not found errorNoClassDefFoundError
- alwayspublic static NoClassDefFoundError raiseFieldNotFound(String name, javassist.NotFoundException e) throws NoClassDefFoundError
name
- the namee
- the not found errorNoClassDefFoundError
- alwaysprotected TypeInfo instantiate(Class clazz)
instantiate
in class org.jboss.util.collection.WeakClassCache<TypeInfo>
protected TypeInfo getTypeInfo(javassist.CtClass ctClass)
ctClass
- the ctClassprotected static String convertName(javassist.CtClass clazz)
clazz
- the classprotected javassist.CtClass getCtClass(String name, ClassLoader classLoader)
name
.name
- the name of the CtClass to be retrievedclassLoader
- the classLoader that loaded the corresponding Class> objectprotected javassist.CtClass getCtClass(String name)
name
by using the bootstrap class pool.name
- the name of the CtClass to be retrievedprotected void generate(Class clazz, TypeInfo result)
generate
in class org.jboss.util.collection.WeakClassCache<TypeInfo>
public TypeInfo getTypeInfo(Class<?> clazz)
TypeInfoFactory
getTypeInfo
in interface TypeInfoFactory
clazz
- the classpublic TypeInfo getTypeInfo(String name, ClassLoader cl) throws ClassNotFoundException
getTypeInfo
in interface TypeInfoFactory
name
- the typecl
- the classloaderClassNotFoundException
- when there is no such classpublic TypeInfo getTypeInfo(Type type)
getTypeInfo
in interface TypeInfoFactory
type
- the typepublic TypeInfo get(String name, ClassLoader cl) throws ClassNotFoundException
get
in class org.jboss.util.collection.WeakClassCache<TypeInfo>
name
- the namecl
- the classloaderClassNotFoundException
- when the class cannot be foundpublic TypeInfo get(Class clazz)
get
in class org.jboss.util.collection.WeakClassCache<TypeInfo>
clazz
- the classprotected TypeInfo get(String name, ClassLoader cl, Class<?> clazz) throws ClassNotFoundException
name
- the namecl
- the classloaderclazz
- the classClassNotFoundException
- when the class cannot be foundprotected TypeInfo get(javassist.CtClass ctClass)
ctClass
- the classprotected TypeInfo get(javassist.CtClass ctClass, Class<?> clazz, String name, ClassLoader cl, boolean delegateToReflectIfNotFound) throws ClassNotFoundException
ctClass
- the class, may be nullclazz
- the class, may be nullname
- the name of the classcl
- the class loaderIllegalArgumentException
- if either name or cl are nullClassNotFoundException
public AnnotationValue[] getAnnotations(Object obj)
AnnotationHelper
getAnnotations
in interface AnnotationHelper
obj
- the annotated objectpublic AnnotationValue createAnnotationValue(AnnotationInfo info, Object ann)
AnnotationHelper
createAnnotationValue
in interface AnnotationHelper
info
- the annotation infoann
- the underlying annotationpublic MutableClassInfo getMutable(String name, ClassLoader cl)
MutableTypeInfoFactory
getMutable
in interface MutableTypeInfoFactory
name
- the name of the class to be retrievedcl
- the ClassLoader that should be used to retrieve the class. Note that,
if cl is null, the default ClassLoader will be used.public MutableClassInfo createNewMutableClass(String name)
MutableTypeInfoFactory
createNewMutableClass
in interface MutableTypeInfoFactory
name
- the name of the class to be createdpublic MutableClassInfo createNewMutableClass(String name, ClassInfo superClass)
MutableTypeInfoFactory
createNewMutableClass
in interface MutableTypeInfoFactory
name
- the name of the class to be createdsuperClass
- the super class of the class to be createdpublic MutableClassInfo createNewMutableInterface(String name)
MutableTypeInfoFactory
createNewMutableInterface
in interface MutableTypeInfoFactory
name
- the name of the interface to be createdpublic MutableClassInfo createNewMutableInterface(String name, ClassInfo superClass)
MutableTypeInfoFactory
createNewMutableInterface
in interface MutableTypeInfoFactory
name
- the name of the interface to be createdsuperClass
- the super type of the interface to be createdprotected TypeInfo getParameterizedType(ParameterizedType type)
type
- the parameterized typeprotected TypeInfo getTypeInfo(ClassLoader loader, javassist.bytecode.SignatureAttribute.Type type, org.jboss.reflect.plugins.javassist.JavassistTypeVariableSpy spy)
loader
- the class loadertype
- the class typespy
- used to determine actual types of type variablesprotected TypeInfo getTypeInfo(ClassLoader loader, javassist.bytecode.SignatureAttribute.ClassType type, org.jboss.reflect.plugins.javassist.JavassistTypeVariableSpy spy)
loader
- the class loader of the raw classtype
- the class typespy
- used to determine actual types of type variablesprotected TypeInfo createTypeInfoForTypeArgument(javassist.bytecode.SignatureAttribute.TypeArgument arg, ClassLoader loader, org.jboss.reflect.plugins.javassist.JavassistTypeVariableSpy spy)
arg
- the type argumentloader
- the class loaderspy
- used to determine actual types of type variablesprotected TypeInfo getWildcardType(WildcardType type)
type
- the wildcard typeprotected Map<String,WeakReference<TypeInfo>> getClassLoaderCache(ClassLoader cl)
getClassLoaderCache
in class org.jboss.util.collection.WeakClassCache<TypeInfo>
cl
- the classloader. If null is used, the Thread context classloader will be used insteadprotected TypeInfo getGenericArrayType(GenericArrayType type)
type
- the array typeprotected ArrayInfo getGenericArrayType(ClassLoader cl, javassist.bytecode.SignatureAttribute.ArrayType type, org.jboss.reflect.plugins.javassist.JavassistTypeVariableSpy spy)
cl
- the classloadertype
- the array typespy
- used to determine actual types of type variablesprotected ArrayInfo getGenericArrayType(ClassLoader cl, JavassistTypeInfoFactoryImpl.ModifiableArrayType type, org.jboss.reflect.plugins.javassist.JavassistTypeVariableSpy spy)
cl
- the classloadertype
- the array typespy
- used to determine actual types of type variablesprotected TypeInfo getTypeVariable(TypeVariable<?> type)
type
- the type variableCopyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.