org.jboss.reflect.plugins.javassist
Class JavassistTypeInfoFactoryImpl

java.lang.Object
  extended by org.jboss.util.collection.WeakClassCache
      extended by org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactoryImpl
All Implemented Interfaces:
AnnotationHelper, TypeInfoFactory

public class JavassistTypeInfoFactoryImpl
extends org.jboss.util.collection.WeakClassCache
implements TypeInfoFactory, AnnotationHelper

A javassist type factory.

Author:
Adrian Brock

Field Summary
 
Fields inherited from class org.jboss.util.collection.WeakClassCache
cache
 
Constructor Summary
JavassistTypeInfoFactoryImpl()
           
 
Method Summary
protected  String convertName(javassist.CtClass clazz)
          Convert name
 AnnotationValue createAnnotationValue(AnnotationInfo info, Object ann)
          Create an annotation from the underlying implementation and its info type
protected  void generate(Class clazz, Object result)
           
 AnnotationValue[] getAnnotations(Object obj)
          Get the annotations for the annotated object
protected  javassist.CtClass getCtClass(String name)
          Get the CtClass
 TypeInfo getTypeInfo(Class<?> clazz)
          Get a type info
protected  TypeInfo getTypeInfo(javassist.CtClass ctClass)
          Get the type info
 TypeInfo getTypeInfo(String name, ClassLoader cl)
          Get a type info
 TypeInfo getTypeInfo(Type type)
          Get a type info
protected  Object instantiate(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
 
Methods inherited from class org.jboss.util.collection.WeakClassCache
get, get, getClassLoaderCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavassistTypeInfoFactoryImpl

public JavassistTypeInfoFactoryImpl()
Method Detail

raiseClassNotFound

public static NoClassDefFoundError raiseClassNotFound(String name,
                                                      javassist.NotFoundException e)
                                               throws NoClassDefFoundError
Raise NoClassDefFoundError for javassist not found

Parameters:
name - the name
e - the not found error
Returns:
never
Throws:
NoClassDefFoundError - always

raiseClassNotFound

public static NoClassDefFoundError raiseClassNotFound(String name,
                                                      ClassNotFoundException e)
                                               throws NoClassDefFoundError
Raise NoClassDefFoundError for javassist not found

Parameters:
name - the name
e - the not found error
Returns:
never
Throws:
NoClassDefFoundError - always

raiseMethodNotFound

public static NoClassDefFoundError raiseMethodNotFound(String name,
                                                       javassist.NotFoundException e)
                                                throws NoClassDefFoundError
Raise NoClassDefFoundError for javassist not found

Parameters:
name - the name
e - the not found error
Returns:
never
Throws:
NoClassDefFoundError - always

raiseFieldNotFound

public static NoClassDefFoundError raiseFieldNotFound(String name,
                                                      javassist.NotFoundException e)
                                               throws NoClassDefFoundError
Raise NoClassDefFoundError for javassist not found

Parameters:
name - the name
e - the not found error
Returns:
never
Throws:
NoClassDefFoundError - always

instantiate

protected Object instantiate(Class clazz)
Specified by:
instantiate in class org.jboss.util.collection.WeakClassCache

getTypeInfo

protected TypeInfo getTypeInfo(javassist.CtClass ctClass)
Get the type info

Parameters:
ctClass - the ctClass
Returns:
the typeinfo

convertName

protected String convertName(javassist.CtClass clazz)
Convert name

Parameters:
clazz - the class
Returns:
the converted name

getCtClass

protected javassist.CtClass getCtClass(String name)
Get the CtClass

Parameters:
name - the name
Returns:
the CtClass

generate

protected void generate(Class clazz,
                        Object result)
Specified by:
generate in class org.jboss.util.collection.WeakClassCache

getTypeInfo

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

Specified by:
getTypeInfo in interface TypeInfoFactory
Parameters:
clazz - the class
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

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

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


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