[jboss-dev-forums] [Design of AOP on JBoss (Aspects/JBoss)] - Re: Creation of method tables in ClassAdvisor
flavia.rainone@jboss.com
do-not-reply at jboss.com
Wed May 13 10:19:00 EDT 2009
Jaikiran wrote : What is the purpose of this code? I guess, there is some specific scenario where this comes into picture
Yes, there is a scenario where this comes into picture. If you navigate through the call hierarchy, you will see that this method is being invoked by both createMethodTables and populateMethodTables, but you will see that createMethodTables invokes populateMethodTables for the superclass of the advised classe:
protected void createMethodTables()
| throws Exception
| {
| initAdvisedMethodsMap();
| populateMethodTables(clazz.getSuperclass());
| addDeclaredMethods(clazz);
| }
Plus, populateMethodTables is recursive on the superclass:
private void populateMethodTables(Class<?> superclass)
| throws Exception
| {
| if (superclass == null) return;
| if (superclass.equals(Object.class)) return;
|
| populateMethodTables(superclass.getSuperclass());
| ...
|
So, we will first verify if the superclass has the unadvised method, if it has, we will use it. There are specific scenarios where the superclass may have the unadvised method, such as when there is a method in the superclass that matches a pointcut. In this scenario, the invocation to getDeclaredMethod that you mentioned is not going to fail.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4230855#4230855
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4230855
More information about the jboss-dev-forums
mailing list