Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Interfaces vs Concrete Classes?

Monal,

Thanks for your suggestions! I had considered your second suggestion but found the cost iterating through the interface definition and class definition for the appropriate method annotation to be too expensive on each joinpoint.

However, I do like your first suggestion. I had not thought of using the distinction between call pointcut designators and execution designators to differentiate between an implementation call and a call against an interface. My only concern with this option is the cost of having two joinpoints evaluate against each intercepted (proper terminology?) call.

When it comes to byte-code weaving if I follow your suggestion, would each intercepted method now perform two checks to see if it an annotation is present?... or would this check happen only during weaving and any subsequent calls to these methods  would only trigger the appropriate advice logic?

In any case, thanks again for your advice!

-Kyle

----- Original Message ----
From: Monal Daxini <monaldax@xxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Sent: Monday, January 29, 2007 3:08:25 PM
Subject: Re: [aspectj-users] Interfaces vs Concrete Classes?

Kyle,

As you may know the annotations on methods are not inherited by
implementing or overriding methods. You could:

1. Use an execution pointcut designator, and then access the signature
and check for the annotation on the implementation method, and also
use a call pointcut designator for the calls on the interface method
and check on the annotation. You could use a variable to track if the
annotation exists on either in your aspect.
Note: This may not be an option if you cannot use execution pointcut designator.

2 In adition to the code in MethodAnnotationAspect, you could use
thisJoinPoint.getTarget (I think this returns the object implementing
the interface)  and then check the annotation.
Note: This is similar to 1 above except that it does not use the
execution pointcut designator.

3. you can use the target pointcut designator
http://www.eclipse.org/aspectj/doc/released/progguide/starting-aspectj.html#pointcuts

Monal
http://www.goi18n.com/
http://goi18n.com/

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.

Back to the top