|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.aspectwerkz.transform.delegation.JavassistHelper
Helper class with utility methods for Javassist.
Constructor Summary | |
JavassistHelper()
|
Method Summary | |
static void |
addAspectManagerField(javassist.CtClass ctClass,
SystemDefinition definition,
Context context)
Adds a new AspectManager field to the advised class. |
static void |
addJoinPointManagerField(javassist.CtClass ctClass,
SystemDefinition definition,
Context context)
Adds a new JoinPointManager field to the advised class. |
static void |
addStaticClassField(javassist.CtClass ctClass,
Context context)
Creates a new static class field. |
static int |
calculateHash(javassist.CtClass ctClass)
Calculate the hash for a class. |
static int |
calculateHash(javassist.CtConstructor constructor)
Calculate the hash for a javassist constructor. |
static int |
calculateHash(javassist.CtField field)
Calculate the hash for a javassist field. |
static int |
calculateHash(javassist.CtMethod method)
Calculate the hash for a javassist method. |
static long |
calculateSerialVerUid(javassist.CtClass clazz)
Copy pasted from Javassist since it is a private method |
static String |
convertJavassistTypeSignatureToReflectTypeSignature(String typeName)
Converts a Javassist type signature to a reflect type signature. |
static void |
copyCustomAttributes(javassist.CtBehavior copyTo,
javassist.CtBehavior copyFrom)
Copies the custom attributes from one class to another. |
static javassist.CtMethod |
createEmptyWrapperMethod(javassist.CtClass ctClass,
javassist.CtMethod originalMethod,
int methodSequence)
Creates an empty wrapper method to allow HotSwap without schema change TODO refactor PrepareTransformer CAUTION: does not check the wrapped method already exists while PrepareTransformer version does |
static List |
createSortedMethodList(javassist.CtClass klass)
Creates a sorted method list of all the public methods in the class and super classes. |
static String |
getDefaultPrimitiveValue(javassist.CtClass type)
Gets the default value for primitive types |
static int |
getJoinPointIndex(javassist.CtClass klass)
Returrns the join point index for the class. |
static boolean |
hasConstructor(javassist.CtClass klass,
javassist.CtClass[] args)
Checks if the given Class as already a ctor with given signature |
static boolean |
hasField(javassist.CtClass klass,
String fieldName)
Checks if the given Class as already a method methodName Does not take into account the signature |
static boolean |
hasMethod(javassist.CtClass klass,
String methodName)
Checks if the given Class as already a method methodName Does not take into account the signature |
static boolean |
hasMethod(javassist.CtClass klass,
String methodName,
javassist.CtClass[] args)
Checks if the given Class as already a method methodName. |
static boolean |
isAnnotatedEmpty(javassist.CtMethod method)
Checks if a method is marked as an empty wrapper (runtime weaving) |
static boolean |
isAnnotatedNotEmpty(javassist.CtMethod method)
Checks if a method is marked as a non empty wrapper (runtime unweaving) |
static boolean |
isSerialVerUidNeeded(javassist.CtClass clazz)
|
static javassist.CtMethod |
makeStatic(javassist.CtClass returnType,
String name,
javassist.CtClass[] parameters,
javassist.CtClass[] exceptions,
String body,
javassist.CtClass declaring)
Helper method for bogus CtMethod.make in Javassist for static methods |
static void |
setAnnotatedEmpty(javassist.CtMethod method)
Sets a method as beeing an empty wrapper |
static void |
setAnnotatedNotEmpty(javassist.CtMethod method)
Sets a method as beeing a non empty wrapper |
static void |
setJoinPointIndex(javassist.CtClass klass,
int index)
Sets the join point index for the class. |
static void |
setSerialVersionUID(javassist.CtClass clazz,
long serialVerUid)
|
static void |
swapBodies(javassist.CtMethod methodA,
javassist.CtMethod methodB)
Swapp bodies of the two given methods of the same declaring class |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JavassistHelper()
Method Detail |
public static javassist.CtMethod makeStatic(javassist.CtClass returnType, String name, javassist.CtClass[] parameters, javassist.CtClass[] exceptions, String body, javassist.CtClass declaring) throws javassist.CannotCompileException
returnType
- name
- parameters
- exceptions
- body
- declaring
-
javassist.CannotCompileException
public static String getDefaultPrimitiveValue(javassist.CtClass type)
type
-
public static boolean hasMethod(javassist.CtClass klass, String methodName)
klass
- methodName
-
public static boolean hasConstructor(javassist.CtClass klass, javassist.CtClass[] args)
klass
- args
-
public static boolean hasField(javassist.CtClass klass, String fieldName)
klass
- fieldName
-
public static boolean hasMethod(javassist.CtClass klass, String methodName, javassist.CtClass[] args)
klass
- methodName
-
public static void swapBodies(javassist.CtMethod methodA, javassist.CtMethod methodB)
methodA
- methodB
- public static String convertJavassistTypeSignatureToReflectTypeSignature(String typeName)
typeName
-
public static boolean isAnnotatedEmpty(javassist.CtMethod method)
method
-
public static boolean isAnnotatedNotEmpty(javassist.CtMethod method)
method
-
public static void setAnnotatedEmpty(javassist.CtMethod method)
method
- public static void setAnnotatedNotEmpty(javassist.CtMethod method)
method
- public static javassist.CtMethod createEmptyWrapperMethod(javassist.CtClass ctClass, javassist.CtMethod originalMethod, int methodSequence) throws javassist.NotFoundException, javassist.CannotCompileException
ctClass
- the ClassGenoriginalMethod
- the current methodmethodSequence
- the method hash
javassist.NotFoundException
javassist.CannotCompileException
public static long calculateSerialVerUid(javassist.CtClass clazz) throws javassist.CannotCompileException
clazz
-
javassist.CannotCompileException
public static void setSerialVersionUID(javassist.CtClass clazz, long serialVerUid) throws javassist.CannotCompileException
javassist.CannotCompileException
public static boolean isSerialVerUidNeeded(javassist.CtClass clazz) throws javassist.NotFoundException
javassist.NotFoundException
public static void addAspectManagerField(javassist.CtClass ctClass, SystemDefinition definition, Context context) throws javassist.NotFoundException, javassist.CannotCompileException
AspectManager
field to the advised class.
ctClass
- definition
-
javassist.NotFoundException
javassist.CannotCompileException
public static void addStaticClassField(javassist.CtClass ctClass, Context context) throws javassist.NotFoundException, javassist.CannotCompileException
ctClass
- the class
javassist.NotFoundException
javassist.CannotCompileException
public static void addJoinPointManagerField(javassist.CtClass ctClass, SystemDefinition definition, Context context) throws javassist.NotFoundException, javassist.CannotCompileException
JoinPointManager
field to the advised class.
ctClass
- definition
-
javassist.NotFoundException
javassist.CannotCompileException
public static void copyCustomAttributes(javassist.CtBehavior copyTo, javassist.CtBehavior copyFrom)
copyTo
- copyFrom
- public static int calculateHash(javassist.CtField field) throws javassist.NotFoundException
field
- the field
javassist.NotFoundException
public static int calculateHash(javassist.CtConstructor constructor) throws javassist.NotFoundException
constructor
- the constructor
javassist.NotFoundException
public static int calculateHash(javassist.CtMethod method) throws javassist.NotFoundException
method
- the method
javassist.NotFoundException
public static int calculateHash(javassist.CtClass ctClass) throws javassist.NotFoundException
ctClass
- the class
javassist.NotFoundException
public static List createSortedMethodList(javassist.CtClass klass)
klass
- the class with the methods
public static int getJoinPointIndex(javassist.CtClass klass)
klass
-
public static void setJoinPointIndex(javassist.CtClass klass, int index)
klass
- index
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |