Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Need advice

 aspect MyProblemAspect{
   pointcut  operationTracker(Foo foo): call ( * Foo.m1(..)) && target(foo);

    public pointcut solution(Foo foo): !withincode( * Foo.m1(..))
                                && operationTracker(foo);

   before(Foo foo): solution(foo) {
     System.out.println(foo.getXXX());
   }
 }

Is it flexible enough? Are there any hidden pitfalls in my solution?

The only pitfall might be, if you are trying to handle decorated objects that way. If you use for example withincode(* Decororator+.*(..)) in your pc above then you potentially execute the advice also for calls to decorating object (as well as to decorated objects).

Stefan



Back to the top