public abstract class Enhancer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Enhancer.ApplicationClassesClasspath
Dumb classpath implementation for javassist hacking
|
Modifier and Type | Field and Description |
---|---|
protected javassist.ClassPool |
classPool |
Constructor and Description |
---|
Enhancer() |
Modifier and Type | Method and Description |
---|---|
protected static void |
createAnnotation(javassist.bytecode.AnnotationsAttribute attribute,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Create a new annotation to be dynamically inserted in the byte code.
|
protected static void |
createAnnotation(javassist.bytecode.AnnotationsAttribute attribute,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
java.util.Map<java.lang.String,javassist.bytecode.annotation.MemberValue> members)
Create a new annotation to be dynamically inserted in the byte code.
|
abstract void |
enhanceThisClass(ApplicationClasses.ApplicationClass applicationClass)
The magic happen here...
|
protected static javassist.bytecode.AnnotationsAttribute |
getAnnotations(javassist.CtClass ctClass)
Retrieve all class annotations.
|
protected static javassist.bytecode.AnnotationsAttribute |
getAnnotations(javassist.CtField ctField)
Retrieve all field annotations.
|
protected static javassist.bytecode.AnnotationsAttribute |
getAnnotations(javassist.CtMethod ctMethod)
Retrieve all method annotations.
|
protected boolean |
hasAnnotation(javassist.CtClass ctClass,
java.lang.String annotation)
Test if a class has the provided annotation
|
protected boolean |
hasAnnotation(javassist.CtField ctField,
java.lang.String annotation)
Test if a field has the provided annotation
|
protected boolean |
hasAnnotation(javassist.CtMethod ctMethod,
java.lang.String annotation)
Test if a method has the provided annotation
|
javassist.CtClass |
makeClass(ApplicationClasses.ApplicationClass applicationClass)
Construct a javassist CtClass from an application class.
|
static javassist.ClassPool |
newClassPool() |
public static javassist.ClassPool newClassPool()
public javassist.CtClass makeClass(ApplicationClasses.ApplicationClass applicationClass) throws java.io.IOException
applicationClass
- The application class to constructjava.io.IOException
- if problem occurred during constructionpublic abstract void enhanceThisClass(ApplicationClasses.ApplicationClass applicationClass) throws java.lang.Exception
applicationClass
- The application class to constructjava.lang.Exception
- if problem occurred during constructionprotected boolean hasAnnotation(javassist.CtClass ctClass, java.lang.String annotation) throws java.lang.ClassNotFoundException
ctClass
- the javassist class representationannotation
- fully qualified name of the annotation class eg."javax.persistence.Entity"java.lang.ClassNotFoundException
- if class not foundprotected boolean hasAnnotation(javassist.CtField ctField, java.lang.String annotation) throws java.lang.ClassNotFoundException
ctField
- the javassist field representationannotation
- fully qualified name of the annotation class eg."javax.persistence.Entity"java.lang.ClassNotFoundException
- if class not foundprotected boolean hasAnnotation(javassist.CtMethod ctMethod, java.lang.String annotation) throws java.lang.ClassNotFoundException
ctMethod
- the javassist method representationannotation
- fully qualified name of the annotation class eg."javax.persistence.Entity"java.lang.ClassNotFoundException
- if class not foundprotected static void createAnnotation(javassist.bytecode.AnnotationsAttribute attribute, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, java.util.Map<java.lang.String,javassist.bytecode.annotation.MemberValue> members)
attribute
- annotation attributeannotationType
- Annotationmembers
- Member of the annotationprotected static void createAnnotation(javassist.bytecode.AnnotationsAttribute attribute, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
attribute
- annotation attributeannotationType
- Annotationprotected static javassist.bytecode.AnnotationsAttribute getAnnotations(javassist.CtClass ctClass)
ctClass
- The given classprotected static javassist.bytecode.AnnotationsAttribute getAnnotations(javassist.CtField ctField)
ctField
- The given fieldprotected static javassist.bytecode.AnnotationsAttribute getAnnotations(javassist.CtMethod ctMethod)
ctMethod
- The given methodsGuillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly