You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pr128237.java 645B

1234567891011121314151617181920212223242526272829
  1. import org.aspectj.lang.JoinPoint;
  2. import org.aspectj.lang.annotation.Aspect;
  3. import org.aspectj.lang.annotation.Before;
  4. import org.aspectj.lang.annotation.Pointcut;
  5. @Aspect
  6. class AbstractTracer
  7. {
  8. @Pointcut("(execution(public * Foo.anotherMethod*(..)) || execution(public * Foo.methodA(..))) && this(obj)")
  9. protected void methodExec(Object obj){};
  10. @Before("methodExec(obj)")
  11. public void beforeMethodExec(JoinPoint thisJoinPoint, Object obj) {
  12. System.out.println("Before " + thisJoinPoint.getSignature().toString());
  13. }
  14. }
  15. class Foo {
  16. public void methodA() {
  17. }
  18. public void anotherMethod() {
  19. }
  20. }