|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.aop.Advisor
org.jboss.aop.ClassAdvisor
public class ClassAdvisor
Advises a class and provides access to the class's aspect chain.
Each advisable class has an associated Advisor
instance.
References methods using int
IDs rather than the actual
instances for
optimal performance. Provides ability to invoke methods on an advised
object without advice (see
Advisor.invokeWithoutAdvisement()
).
Field Summary | |
---|---|
protected HashMap |
backrefConCalledByConstructorBindings
|
protected HashMap |
backrefConCalledByMethodBindings
|
protected HashMap |
backrefMethodCalledByConstructorBindings
|
protected HashMap |
backrefMethodCalledByMethodBindings
|
protected HashMap[] |
conCalledByConBindings
|
protected HashMap[] |
conCalledByConInterceptors
|
protected gnu.trove.TLongObjectHashMap |
conCalledByMethodBindings
|
protected gnu.trove.TLongObjectHashMap |
conCalledByMethodInterceptors
|
protected boolean |
initialized
|
protected HashMap[] |
methodCalledByConBindings
|
protected HashMap[] |
methodCalledByConInterceptors
|
protected gnu.trove.TLongObjectHashMap |
methodCalledByMethodBindings
|
protected gnu.trove.TLongObjectHashMap |
methodCalledByMethodInterceptors
|
static String |
NOT_TRANSFORMABLE_SUFFIX
Suffix added to unadvised methods. |
Constructor Summary | |
---|---|
ClassAdvisor(String classname,
AspectManager manager)
|
Method Summary | |
---|---|
void |
addClassMetaData(ClassMetaDataBinding data)
|
void |
addConstructorCalledByConPointcut(int callingIndex,
String calledClass,
long calledConHash,
AdviceBinding binding)
|
void |
addConstructorCalledByMethodPointcut(long callingMethodHash,
String calledClass,
long calledMethodHash,
AdviceBinding binding)
|
void |
addConstructorCallerPointcut(int callingIndex,
String calledClass,
long calledMethodHash,
AdviceBinding binding)
|
void |
addMethodCalledByMethodPointcut(long callingMethodHash,
String calledClass,
long calledMethodHash,
AdviceBinding binding)
|
void |
attachClass(Class clazz)
Constructs a new helper. |
protected void |
bindClassMetaData(ClassMetaDataBinding data)
|
protected void |
createInterceptorChains()
|
protected void |
finalizeFieldChain(ArrayList newFieldInterceptors)
|
Field[] |
getAdvisedFields()
|
gnu.trove.TLongObjectHashMap |
getAdvisedMethods()
|
HashMap[] |
getConCalledByConInterceptors()
|
gnu.trove.TLongObjectHashMap |
getConCalledByMethodInterceptors()
|
int |
getConstructorIndex(Constructor constructor)
Get a constructor's index in the class. |
Constructor[] |
getConstructors()
|
Object |
getFieldAspect(FieldJoinpoint joinpoint,
AspectDefinition def)
This method is to support PER_JOINPOINT scoping of Aspects for static fields Fields are special in that a get and set do not create separate aspect instances. |
int |
getFieldIndex(Field field)
Get a field's index in the class. |
Interceptor[][] |
getFieldReadInterceptors()
|
Interceptor[][] |
getFieldWriteInterceptors()
|
HashMap[] |
getMethodCalledByConInterceptors()
|
gnu.trove.TLongObjectHashMap |
getMethodCalledByMethodBindings()
|
gnu.trove.TLongObjectHashMap |
getMethodCalledByMethodInterceptors()
|
gnu.trove.TLongObjectHashMap |
getMethodInterceptors()
|
gnu.trove.TLongObjectHashMap |
getUnadvisedMethods()
|
protected CallerMethodInfo |
initializeCallerInterceptorsMap(long callingMethodHash,
String calledClass,
long calledMethodHash,
Method calledMethod)
|
void |
initializeConCalledByConEmptyChain(int callingIndex,
String calledClass,
long calledConHash)
|
protected CallerConstructorInfo |
initializeConCalledByConInterceptorsMap(int callingIndex,
String calledClass,
long calledConHash,
Constructor calledCon)
|
void |
initializeConCalledByMethodEmptyChain(long callingMethodHash,
String calledClass,
long calledConHash)
|
protected CallerConstructorInfo |
initializeConCalledByMethodInterceptorsMap(long callingMethodHash,
String calledClass,
long calledConHash,
Constructor calledCon)
|
protected CallerMethodInfo |
initializeConstructorCallerInterceptorsMap(int callingIndex,
String calledClass,
long calledMethodHash,
Method calledMethod)
|
void |
initializeEmptyCallerChain(long callingMethodHash,
String calledClass,
long calledMethodHash)
|
void |
initializeEmptyConstructorCallerChain(int callingIndex,
String calledClass,
long calledMethodHash)
|
protected ArrayList |
initializeFieldChain()
|
protected gnu.trove.TLongObjectHashMap |
initializeMethodChain()
|
Object |
invoke(Invocation invocation)
Helper method This is the end of the chain |
Object |
invokeCaller(long callingMethodHash,
Object target,
Object[] args,
CallerMethodInfo info,
Object callingObject)
|
Object |
invokeConCalledByCon(int callingIndex,
Object[] args,
CallerConstructorInfo info)
|
Object |
invokeConCalledByMethod(long callingMethodHash,
Object[] args,
CallerConstructorInfo info,
Object callingObject)
|
Object |
invokeConstructorCaller(int callingIndex,
Object target,
Object[] args,
CallerMethodInfo info)
|
Object |
invokeMethod(ClassInstanceAdvisor instanceAdvisor,
Object target,
long methodHash,
Object[] arguments,
MethodInfo info)
|
Object |
invokeMethod(InstanceAdvisor instanceAdvisor,
Object target,
long methodHash,
Object[] arguments)
|
Object |
invokeMethod(long methodHash,
Object[] arguments)
|
Object |
invokeMethod(Object target,
long methodHash,
Object[] arguments)
|
Object |
invokeNew(Object[] args,
int idx)
|
Object |
invokeNewWithoutAdvisement(Object[] arguments,
Constructor constructor)
|
Object |
invokeRead(Object target,
int index)
Invokes interceptor chain. |
Object |
invokeWithoutAdvisement(Object target,
long methodHash,
Object[] arguments)
Invokes target object without applying interceptors. |
Object |
invokeWrite(Object target,
int index,
Object value)
Invokes interceptor chain. |
static boolean |
isAdvisable(Field field)
Is the field advisable? |
static boolean |
isAdvisable(Method method)
Is the method advisable? |
static boolean |
isWithoutAdvisement(String name)
Is this the name of a private, unadvised thing? |
static String |
notAdvisedMethodName(String className,
String methodName)
Generates internal, unadvised version of a method name. |
protected void |
populateMixinMethods()
Put mixin methods from mixin class into unadvisedMethods map so that they can be correctly invoked upon. |
protected void |
rebindClassMetaData()
|
protected void |
rebuildCallerInterceptors()
|
protected void |
rebuildInterceptors()
|
void |
removeAdviceBinding(AdviceBinding binding)
|
void |
removeAdviceBindings(ArrayList bindings)
|
void |
removeCallerPointcut(AdviceBinding binding)
|
void |
removeClassMetaData(ClassMetaDataBinding data)
|
CallerConstructorInfo |
resolveCallerConstructorInfo(long callingMethodHash,
String calledClass,
long calledConHash)
|
CallerMethodInfo |
resolveCallerMethodInfo(long callingMethodHash,
String calledClass,
long calledMethodHash)
|
CallerConstructorInfo |
resolveConstructorCallerConstructorInfo(int callingIndex,
String calledClass,
long calledConHash)
|
CallerMethodInfo |
resolveConstructorCallerMethodInfo(int callingIndex,
String calledClass,
long calledMethodHash)
|
protected void |
resolveFieldPointcut(ArrayList newFieldInterceptors,
AdviceBinding binding,
boolean write)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String NOT_TRANSFORMABLE_SUFFIX
protected gnu.trove.TLongObjectHashMap methodCalledByMethodBindings
protected HashMap backrefMethodCalledByMethodBindings
protected gnu.trove.TLongObjectHashMap methodCalledByMethodInterceptors
protected gnu.trove.TLongObjectHashMap conCalledByMethodBindings
protected HashMap backrefConCalledByMethodBindings
protected gnu.trove.TLongObjectHashMap conCalledByMethodInterceptors
protected HashMap[] methodCalledByConBindings
protected HashMap[] methodCalledByConInterceptors
protected HashMap backrefMethodCalledByConstructorBindings
protected HashMap[] conCalledByConBindings
protected HashMap[] conCalledByConInterceptors
protected HashMap backrefConCalledByConstructorBindings
protected boolean initialized
Constructor Detail |
---|
public ClassAdvisor(String classname, AspectManager manager)
Method Detail |
---|
public Object getFieldAspect(FieldJoinpoint joinpoint, AspectDefinition def)
joinpoint
- def
-
public Field[] getAdvisedFields()
public gnu.trove.TLongObjectHashMap getAdvisedMethods()
public gnu.trove.TLongObjectHashMap getUnadvisedMethods()
public Constructor[] getConstructors()
getConstructors
in class Advisor
public gnu.trove.TLongObjectHashMap getMethodCalledByMethodInterceptors()
public HashMap[] getMethodCalledByConInterceptors()
public HashMap[] getConCalledByConInterceptors()
public gnu.trove.TLongObjectHashMap getConCalledByMethodInterceptors()
public gnu.trove.TLongObjectHashMap getMethodCalledByMethodBindings()
public Interceptor[][] getFieldReadInterceptors()
public Interceptor[][] getFieldWriteInterceptors()
public gnu.trove.TLongObjectHashMap getMethodInterceptors()
public void attachClass(Class clazz)
public int getConstructorIndex(Constructor constructor)
public int getFieldIndex(Field field)
protected void populateMixinMethods() throws Exception
Exception
public void removeAdviceBinding(AdviceBinding binding)
removeAdviceBinding
in class Advisor
public void removeAdviceBindings(ArrayList bindings)
removeAdviceBindings
in class Advisor
protected void resolveFieldPointcut(ArrayList newFieldInterceptors, AdviceBinding binding, boolean write)
protected gnu.trove.TLongObjectHashMap initializeMethodChain()
protected ArrayList initializeFieldChain()
protected void finalizeFieldChain(ArrayList newFieldInterceptors)
protected void createInterceptorChains() throws Exception
Exception
protected CallerMethodInfo initializeCallerInterceptorsMap(long callingMethodHash, String calledClass, long calledMethodHash, Method calledMethod) throws Exception
Exception
protected CallerConstructorInfo initializeConCalledByMethodInterceptorsMap(long callingMethodHash, String calledClass, long calledConHash, Constructor calledCon) throws Exception
Exception
protected CallerMethodInfo initializeConstructorCallerInterceptorsMap(int callingIndex, String calledClass, long calledMethodHash, Method calledMethod) throws Exception
Exception
protected CallerConstructorInfo initializeConCalledByConInterceptorsMap(int callingIndex, String calledClass, long calledConHash, Constructor calledCon) throws Exception
Exception
protected void rebuildCallerInterceptors() throws Exception
Exception
protected void rebuildInterceptors()
rebuildInterceptors
in class Advisor
protected void bindClassMetaData(ClassMetaDataBinding data)
protected void rebindClassMetaData()
public void addClassMetaData(ClassMetaDataBinding data)
addClassMetaData
in class Advisor
public void removeClassMetaData(ClassMetaDataBinding data)
removeClassMetaData
in class Advisor
public void initializeEmptyCallerChain(long callingMethodHash, String calledClass, long calledMethodHash) throws Exception
Exception
public void initializeConCalledByMethodEmptyChain(long callingMethodHash, String calledClass, long calledConHash) throws Exception
Exception
public void initializeEmptyConstructorCallerChain(int callingIndex, String calledClass, long calledMethodHash) throws Exception
Exception
public void initializeConCalledByConEmptyChain(int callingIndex, String calledClass, long calledConHash) throws Exception
Exception
public void addMethodCalledByMethodPointcut(long callingMethodHash, String calledClass, long calledMethodHash, AdviceBinding binding) throws Exception
Exception
public void addConstructorCalledByMethodPointcut(long callingMethodHash, String calledClass, long calledMethodHash, AdviceBinding binding) throws Exception
Exception
public void addConstructorCallerPointcut(int callingIndex, String calledClass, long calledMethodHash, AdviceBinding binding) throws Exception
Exception
public void addConstructorCalledByConPointcut(int callingIndex, String calledClass, long calledConHash, AdviceBinding binding) throws Exception
Exception
public void removeCallerPointcut(AdviceBinding binding)
public static String notAdvisedMethodName(String className, String methodName)
public static boolean isWithoutAdvisement(String name)
public static boolean isAdvisable(Field field)
public static boolean isAdvisable(Method method)
public CallerMethodInfo resolveCallerMethodInfo(long callingMethodHash, String calledClass, long calledMethodHash)
public CallerConstructorInfo resolveCallerConstructorInfo(long callingMethodHash, String calledClass, long calledConHash)
public CallerMethodInfo resolveConstructorCallerMethodInfo(int callingIndex, String calledClass, long calledMethodHash)
public CallerConstructorInfo resolveConstructorCallerConstructorInfo(int callingIndex, String calledClass, long calledConHash)
public Object invokeWithoutAdvisement(Object target, long methodHash, Object[] arguments) throws Throwable
Throwable
public Object invokeNewWithoutAdvisement(Object[] arguments, Constructor constructor) throws Throwable
Throwable
public Object invokeMethod(long methodHash, Object[] arguments) throws Throwable
Throwable
public Object invokeMethod(Object target, long methodHash, Object[] arguments) throws Throwable
Throwable
public Object invokeMethod(InstanceAdvisor instanceAdvisor, Object target, long methodHash, Object[] arguments) throws Throwable
Throwable
public Object invokeMethod(ClassInstanceAdvisor instanceAdvisor, Object target, long methodHash, Object[] arguments, MethodInfo info) throws Throwable
Throwable
public Object invokeCaller(long callingMethodHash, Object target, Object[] args, CallerMethodInfo info, Object callingObject) throws Throwable
Throwable
public Object invokeConCalledByMethod(long callingMethodHash, Object[] args, CallerConstructorInfo info, Object callingObject) throws Throwable
Throwable
public Object invokeConstructorCaller(int callingIndex, Object target, Object[] args, CallerMethodInfo info) throws Throwable
Throwable
public Object invokeConCalledByCon(int callingIndex, Object[] args, CallerConstructorInfo info) throws Throwable
Throwable
public Object invokeNew(Object[] args, int idx) throws Throwable
Throwable
public Object invokeRead(Object target, int index) throws Throwable
Throwable
public Object invokeWrite(Object target, int index, Object value) throws Throwable
Throwable
public Object invoke(Invocation invocation) throws Throwable
Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |