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.

A.java 609B

1234567891011121314151617181920212223242526272829303132
  1. import org.aspectj.lang.annotation.Aspect;
  2. import org.aspectj.lang.annotation.Before;
  3. import org.aspectj.lang.annotation.Pointcut;
  4. public class A {
  5. public static void main(String []argv) {
  6. System.out.println("A.main");
  7. }
  8. }
  9. @Aspect
  10. class Azpect {
  11. @Pointcut("if(false)")
  12. public void isFalse() { }
  13. @Pointcut("if(true)")
  14. public void isTrue() { }
  15. @Before("isTrue() && execution(* A.main(..))")
  16. public void beforeTrue() {
  17. System.out.println("Azpect.beforeTrue");
  18. }
  19. @Before("isFalse() && execution(* A.main(..))")
  20. public void beforeFalse() {
  21. System.out.println("Azpect.beforeFalse");
  22. }
  23. }