[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] example pointcut

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
_________________________________________