Hi -

I have a question regarding initialization pointcuts for interfaces.

Suppose I have an initialization pointcut as :

initialization(Interface+.new(..)), where Interface is a Java interface and
I have a class as :

public class Implementation implements Interface {
   // ...
}

In this case I get 2 initialization joinpoints - one for the interface and
the other for the implementation. In case, in the after-returning advice, I
would like to ignore the interface specific one, what is the best practice
for doing this ? I do not want to introduce the implementation class within
the advice, since I can have multiple implementations of this interface. I
came up with the following ..

after(Interface client) returning :
       clientCreation(client) {
       if ("org.dg.biz.Interface".equals(
               thisJoinPoint.getSignature().getDeclaringTypeName())) {
           return;
       }
       // .. rest of the advice
}

However, I do not like this string comparison. Is there a better way to
achieve this ?

Thanks.
- Debasish
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to