[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] example pointcut
|
Uwe,
this(LogObject) (or this(l) with l mapped to LogObject)
won't match any static methods -- it will match only
join points where "this instanceof LogObject" is true.
Unless you need to keep some per-object state, I don't
see need to use "declare parents" constructs in your
example:
Try the following pointcut definition:
pointcut logPoints(LogObject l) :
execution(public com.donv..*+.*(..)
&& !within(LogAspect);
-Ramnivas
--- Uwe Kubosch <donv@xxxxxxxxxxxx> wrote:
> Hi all!
>
> I wish to trace all calls to public methods in package com.donv and
> all
> subpackages.
>
> I have an aspect:
>
> package no.milron.espresso.aspects;
>
> aspect LogAspect {
> public interface LogObject {}
> declare parents: com.donv..* implements LogObject;
>
> pointcut logPoints(LogObject l) :
> this(l)
> && (execution(public * *(..)) || execution(public static *
> *(..)))
> && !within(LogAspect)
> ;
>
> before() : logPoints() {
> System.out.println("AspectJ Log " + thisJoinPoint);
> }
> }
>
> In a servlet com.donv.espresso.servlets.EspressoServlet I have static
> calls
> to com.donv.util.Logger.info(..) that I wish to trace. The above
> aspect
> logs the call to EspressoServlet.init(..), but not to
> Logger.info(..).
>
> Can somebody explain why not, and give me a working example?
>
>
> With kind regards,
>
> Uwe Kubosch
>
> _________________________________________
> Uwe Kubosch
> Adviser eCommerce
> ICQ#: 71437007
> More ways to contact me: http://wwp.icq.com/71437007
> _________________________________________
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com