|
||||||||||
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 Field[] |
advisedFields
|
protected HashMap<String,ArrayList<ArrayList<AdviceBinding>>> |
backrefConCalledByConstructorBindings
|
protected HashMap<String,ArrayList<ArrayList<AdviceBinding>>> |
backrefMethodCalledByConstructorBindings
|
protected HashMap<String,gnu.trove.TLongObjectHashMap>[] |
conCalledByConBindings
|
protected HashMap<String,gnu.trove.TLongObjectHashMap>[] |
conCalledByConInterceptors
|
protected FieldInfo[] |
fieldReadInfos
|
protected FieldInfo[] |
fieldWriteInfos
|
protected boolean |
initialized
|
protected HashMap<String,gnu.trove.TLongObjectHashMap>[] |
methodCalledByConBindings
|
protected HashMap<String,gnu.trove.TLongObjectHashMap>[] |
methodCalledByConInterceptors
|
static String |
NOT_TRANSFORMABLE_SUFFIX
Suffix added to unadvised methods. |
protected gnu.trove.TLongObjectHashMap |
unadvisedMethods
|
Constructor Summary | |
---|---|
ClassAdvisor(Class<?> clazz,
AspectManager manager)
|
|
ClassAdvisor(String classname,
AspectManager manager)
|
Method Summary | |
---|---|
void |
addClassMetaData(ClassMetaDataBinding data)
|
void |
addConstructorCallerPointcut(int callingIndex,
String calledClass,
long calledMethodHash,
AdviceBinding binding)
|
protected void |
addDeclaredMethods(Class<?> superclass)
|
void |
attachClass(Class<?> clazz)
Constructs a new helper. |
protected void |
bindClassMetaData(ClassMetaDataBinding data)
|
void |
cleanup()
|
protected void |
createConstructorTables()
|
protected void |
createFieldTable()
Gets advised methods. |
protected void |
createInterceptorChains()
|
protected void |
createMethodTables()
|
protected void |
doRebuildInterceptors()
|
protected void |
doRebuildInterceptorsForAddedBinding(AdviceBinding binding)
|
protected void |
doRebuildInterceptorsForRemovedBinding(AdviceBinding removedBinding)
|
protected void |
finalizeChains()
|
protected void |
finalizeConCalledByConInterceptorChain(ConByConInfo info)
|
protected void |
finalizeConCalledByMethodInterceptorChain(ConByMethodInfo info)
|
protected void |
finalizeMethodCalledByConInterceptorChain(MethodByConInfo info)
|
protected void |
finalizeMethodCalledByMethodInterceptorChain(MethodByMethodInfo info)
|
Field[] |
getAdvisedFields()
|
gnu.trove.TLongObjectHashMap |
getAdvisedMethods()
|
protected org.jboss.aop.ClassAdvisor.ConByMethodData |
getConByMethodData()
|
HashMap<String,gnu.trove.TLongObjectHashMap>[] |
getConCalledByConInterceptors()
|
gnu.trove.TLongObjectHashMap |
getConCalledByMethodInterceptors()
|
int |
getConstructorIndex(Constructor<?> constructor)
Get a constructor's index in the class. |
Constructor<?>[] |
getConstructors()
Returns the list of constructors that belong to the advised context. |
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. |
FieldInfo[] |
getFieldReadInfos()
|
Interceptor[][] |
getFieldReadInterceptors()
Deprecated. use getFieldReadInfos instead |
FieldInfo[] |
getFieldWriteInfos()
|
Interceptor[][] |
getFieldWriteInterceptors()
Deprecated. use getFieldWriteInfos instead |
protected org.jboss.aop.InterceptorChainObserver |
getInterceptorChainObserver()
Returns the interceptor chain observer associated with this advisor. |
protected org.jboss.aop.ClassAdvisor.MethodByMethodData |
getMethodByMethodData()
|
HashMap<String,gnu.trove.TLongObjectHashMap>[] |
getMethodCalledByConInterceptors()
|
gnu.trove.TLongObjectHashMap |
getMethodCalledByMethodBindings()
|
gnu.trove.TLongObjectHashMap |
getMethodCalledByMethodInterceptors()
|
gnu.trove.TLongObjectHashMap |
getMethodInterceptors()
|
protected gnu.trove.TLongObjectHashMap |
getUnadvisedMethods()
|
protected void |
initializeFieldReadChain()
|
protected void |
initializeFieldWriteChain()
|
protected void |
initializeMethodChain()
|
Object |
invoke(Invocation invocation)
Invokes interceptor chain. |
Object |
invokeCaller(long callingMethodHash,
Object target,
Object[] args,
CallerMethodInfo info,
Object callingObject)
Deprecated. |
Object |
invokeCaller(MethodByMethodInfo info,
Object callingObject,
Object target,
Object[] args)
|
Object |
invokeConCalledByCon(ConByConInfo info,
Object[] args)
Deprecated. Prefer using the version with callingObject instead of this one,
since this object is available for call invocations made inside constructors. |
Object |
invokeConCalledByCon(ConByConInfo info,
Object callingObject,
Object[] args)
|
Object |
invokeConCalledByCon(int callingIndex,
Object[] args,
CallerConstructorInfo info)
Deprecated. |
Object |
invokeConCalledByCon(int callingIndex,
Object callingObject,
Object[] args,
CallerConstructorInfo info)
Deprecated. |
Object |
invokeConCalledByMethod(ConByMethodInfo info,
Object callingObject,
Object[] args)
|
Object |
invokeConCalledByMethod(long callingMethodHash,
Object[] args,
CallerConstructorInfo info,
Object callingObject)
Deprecated. |
Object |
invokeConstructorCaller(int callingIndex,
Object target,
Object[] args,
CallerMethodInfo info)
Deprecated. |
Object |
invokeConstructorCaller(int callingIndex,
Object callingObject,
Object target,
Object[] args,
CallerMethodInfo info)
Deprecated. |
Object |
invokeConstructorCaller(MethodByConInfo info,
Object target,
Object[] args)
Deprecated. Prefer using the version with callingObject instead of this one,
since this object is available for call invocations made inside constructors. |
Object |
invokeConstructorCaller(MethodByConInfo info,
Object callingObject,
Object target,
Object[] args)
|
Object |
invokeMethod(InstanceAdvisor instanceAdvisor,
Object target,
long methodHash,
Object[] arguments)
|
Object |
invokeMethod(InstanceAdvisor instanceAdvisor,
Object target,
long methodHash,
Object[] arguments,
MethodInfo info)
|
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(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 |
populateInterceptorsFromInfos()
Deprecated. We should just be using xxxxInfos |
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()
|
protected void |
rebuildInterceptorsForAddedBinding(AdviceBinding binding)
|
protected void |
rebuildInterceptorsForRemovedBinding(AdviceBinding binding)
|
void |
removeAdviceBinding(AdviceBinding binding)
|
void |
removeAdviceBindings(ArrayList<AdviceBinding> bindings)
|
void |
removeClassMetaData(ClassMetaDataBinding data)
|
ConByMethodInfo |
resolveCallerConstructorInfo(long callingMethodHash,
String calledClass,
long calledConHash)
|
WeakReference<ConByMethodInfo> |
resolveCallerConstructorInfoAsWeakReference(long callingMethodHash,
String calledClass,
long calledConHash)
|
MethodByMethodInfo |
resolveCallerMethodInfo(long callingMethodHash,
String calledClass,
long calledMethodHash)
|
WeakReference<MethodByMethodInfo> |
resolveCallerMethodInfoAsWeakReference(long callingMethodHash,
String calledClass,
long calledMethodHash)
|
ConByConInfo |
resolveConstructorCallerConstructorInfo(Class<?> callingClass,
int callingIndex,
String calledClass,
long calledConHash)
|
ConByConInfo |
resolveConstructorCallerConstructorInfo(int callingIndex,
String calledClass,
long calledConHash)
|
WeakReference<ConByConInfo> |
resolveConstructorCallerConstructorInfoAsWeakReference(Class<?> callingClass,
int callingIndex,
String calledClass,
long calledConHash)
|
WeakReference<ConByConInfo> |
resolveConstructorCallerConstructorInfoAsWeakReference(int callingIndex,
String calledClass,
long calledConHash)
Deprecated. |
MethodByConInfo |
resolveConstructorCallerMethodInfo(Class<?> callingClass,
int callingIndex,
String calledClass,
long calledMethodHash)
|
MethodByConInfo |
resolveConstructorCallerMethodInfo(int callingIndex,
String calledClass,
long calledMethodHash)
Deprecated. |
WeakReference<MethodByConInfo> |
resolveConstructorCallerMethodInfoAsWeakReference(Class<?> callingClass,
int callingIndex,
String calledClass,
long calledMethodHash)
|
WeakReference<MethodByConInfo> |
resolveConstructorCallerMethodInfoAsWeakReference(int callingIndex,
String calledClass,
long calledMethodHash)
Deprecated. |
protected void |
resolveFieldPointcut(FieldInfo[] newFieldInfos,
Interceptor[][] interceptors,
AdviceBinding binding,
boolean write)
|
protected void |
resolvePointcuts(AdviceBinding binding)
|
protected void |
setInterceptorChainObserver(org.jboss.aop.InterceptorChainObserver observer)
Defines the interceptor chain observer associated with this advisor. |
protected void |
updateFieldPointcutAfterRemove(FieldInfo fieldInfo,
int i,
boolean write)
|
protected void |
updateInterceptorChains()
|
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 unadvisedMethods
protected HashMap<String,gnu.trove.TLongObjectHashMap>[] methodCalledByConBindings
protected HashMap<String,gnu.trove.TLongObjectHashMap>[] methodCalledByConInterceptors
protected HashMap<String,ArrayList<ArrayList<AdviceBinding>>> backrefMethodCalledByConstructorBindings
protected HashMap<String,gnu.trove.TLongObjectHashMap>[] conCalledByConBindings
protected HashMap<String,gnu.trove.TLongObjectHashMap>[] conCalledByConInterceptors
protected HashMap<String,ArrayList<ArrayList<AdviceBinding>>> backrefConCalledByConstructorBindings
protected FieldInfo[] fieldReadInfos
protected FieldInfo[] fieldWriteInfos
protected Field[] advisedFields
protected boolean initialized
Constructor Detail |
---|
public ClassAdvisor(String classname, AspectManager manager)
public ClassAdvisor(Class<?> clazz, AspectManager manager)
Method Detail |
---|
public Object getFieldAspect(FieldJoinpoint joinpoint, AspectDefinition def)
joinpoint
- def
-
public Field[] getAdvisedFields()
public gnu.trove.TLongObjectHashMap getAdvisedMethods()
protected gnu.trove.TLongObjectHashMap getUnadvisedMethods()
public Constructor<?>[] getConstructors()
Advisor
getConstructors
in class Advisor
public gnu.trove.TLongObjectHashMap getMethodCalledByMethodInterceptors()
public HashMap<String,gnu.trove.TLongObjectHashMap>[] getMethodCalledByConInterceptors()
public HashMap<String,gnu.trove.TLongObjectHashMap>[] getConCalledByConInterceptors()
public gnu.trove.TLongObjectHashMap getConCalledByMethodInterceptors()
public gnu.trove.TLongObjectHashMap getMethodCalledByMethodBindings()
public Interceptor[][] getFieldReadInterceptors()
public FieldInfo[] getFieldReadInfos()
public Interceptor[][] getFieldWriteInterceptors()
public FieldInfo[] getFieldWriteInfos()
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<AdviceBinding> bindings)
removeAdviceBindings
in class Advisor
protected void resolveFieldPointcut(FieldInfo[] newFieldInfos, Interceptor[][] interceptors, AdviceBinding binding, boolean write)
protected void initializeMethodChain()
protected void initializeFieldReadChain()
protected void initializeFieldWriteChain()
protected void createInterceptorChains() throws Exception
Exception
protected void updateInterceptorChains() throws Exception
Exception
protected void finalizeChains()
protected void resolvePointcuts(AdviceBinding binding)
protected void rebuildInterceptorsForRemovedBinding(AdviceBinding binding)
rebuildInterceptorsForRemovedBinding
in class Advisor
protected void doRebuildInterceptorsForRemovedBinding(AdviceBinding removedBinding)
protected void updateFieldPointcutAfterRemove(FieldInfo fieldInfo, int i, boolean write)
updateFieldPointcutAfterRemove
in class Advisor
protected void rebuildCallerInterceptors() throws Exception
Exception
protected void finalizeMethodCalledByMethodInterceptorChain(MethodByMethodInfo info)
protected void finalizeConCalledByMethodInterceptorChain(ConByMethodInfo info)
protected void finalizeConCalledByConInterceptorChain(ConByConInfo info)
protected void finalizeMethodCalledByConInterceptorChain(MethodByConInfo info)
protected void rebuildInterceptors()
rebuildInterceptors
in class Advisor
protected void doRebuildInterceptors()
protected void rebuildInterceptorsForAddedBinding(AdviceBinding binding)
rebuildInterceptorsForAddedBinding
in class Advisor
protected void doRebuildInterceptorsForAddedBinding(AdviceBinding binding)
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 addConstructorCallerPointcut(int callingIndex, String calledClass, long calledMethodHash, AdviceBinding binding) throws Exception
Exception
public static String notAdvisedMethodName(String className, String methodName)
public static boolean isWithoutAdvisement(String name)
public static boolean isAdvisable(Method method)
protected void createFieldTable() throws Exception
Exception
protected void addDeclaredMethods(Class<?> superclass) throws Exception
Exception
protected void createMethodTables() throws Exception
Exception
protected void createConstructorTables() throws Exception
Exception
public MethodByMethodInfo resolveCallerMethodInfo(long callingMethodHash, String calledClass, long calledMethodHash)
public WeakReference<MethodByMethodInfo> resolveCallerMethodInfoAsWeakReference(long callingMethodHash, String calledClass, long calledMethodHash)
public ConByMethodInfo resolveCallerConstructorInfo(long callingMethodHash, String calledClass, long calledConHash)
public WeakReference<ConByMethodInfo> resolveCallerConstructorInfoAsWeakReference(long callingMethodHash, String calledClass, long calledConHash)
@Deprecated public MethodByConInfo resolveConstructorCallerMethodInfo(int callingIndex, String calledClass, long calledMethodHash)
public MethodByConInfo resolveConstructorCallerMethodInfo(Class<?> callingClass, int callingIndex, String calledClass, long calledMethodHash)
@Deprecated public WeakReference<MethodByConInfo> resolveConstructorCallerMethodInfoAsWeakReference(int callingIndex, String calledClass, long calledMethodHash)
public WeakReference<MethodByConInfo> resolveConstructorCallerMethodInfoAsWeakReference(Class<?> callingClass, int callingIndex, String calledClass, long calledMethodHash)
public ConByConInfo resolveConstructorCallerConstructorInfo(int callingIndex, String calledClass, long calledConHash)
public ConByConInfo resolveConstructorCallerConstructorInfo(Class<?> callingClass, int callingIndex, String calledClass, long calledConHash)
@Deprecated public WeakReference<ConByConInfo> resolveConstructorCallerConstructorInfoAsWeakReference(int callingIndex, String calledClass, long calledConHash)
public WeakReference<ConByConInfo> resolveConstructorCallerConstructorInfoAsWeakReference(Class<?> callingClass, 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(InstanceAdvisor 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 invokeCaller(MethodByMethodInfo info, Object callingObject, Object target, Object[] args) throws Throwable
Throwable
public Object invokeConCalledByMethod(long callingMethodHash, Object[] args, CallerConstructorInfo info, Object callingObject) throws Throwable
Throwable
public Object invokeConCalledByMethod(ConByMethodInfo info, Object callingObject, Object[] args) throws Throwable
Throwable
public Object invokeConstructorCaller(int callingIndex, Object target, Object[] args, CallerMethodInfo info) throws Throwable
Throwable
public Object invokeConstructorCaller(int callingIndex, Object callingObject, Object target, Object[] args, CallerMethodInfo info) throws Throwable
Throwable
public Object invokeConstructorCaller(MethodByConInfo info, Object target, Object[] args) throws Throwable
callingObject
instead of this one,
since this object is available for call invocations made inside constructors.
Throwable
invokeConstructorCaller(MethodByConInfo, Object, Object, Object[])
public Object invokeConstructorCaller(MethodByConInfo info, Object callingObject, Object target, Object[] args) throws Throwable
Throwable
public Object invokeConCalledByCon(int callingIndex, Object[] args, CallerConstructorInfo info) throws Throwable
Throwable
public Object invokeConCalledByCon(int callingIndex, Object callingObject, Object[] args, CallerConstructorInfo info) throws Throwable
Throwable
public Object invokeConCalledByCon(ConByConInfo info, Object[] args) throws Throwable
callingObject
instead of this one,
since this object is available for call invocations made inside constructors.
Throwable
invokeConCalledByCon(ConByConInfo, Object, Object[])
public Object invokeConCalledByCon(ConByConInfo info, Object callingObject, Object[] args) 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
public void cleanup()
cleanup
in class Advisor
protected org.jboss.aop.InterceptorChainObserver getInterceptorChainObserver()
protected void setInterceptorChainObserver(org.jboss.aop.InterceptorChainObserver observer)
observer
- the interceptor chain observer.protected void populateInterceptorsFromInfos()
populateInterceptorsFromInfos
in class Advisor
protected org.jboss.aop.ClassAdvisor.MethodByMethodData getMethodByMethodData()
protected org.jboss.aop.ClassAdvisor.ConByMethodData getConByMethodData()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |