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.

Eight.java 495B

123456789101112131415161718192021222324252627
  1. public class Eight {
  2. public static void main(String[] argv) {
  3. Eight a = new Eight();
  4. a.m();
  5. }
  6. public void m() {
  7. System.out.println("Method m() running");
  8. }
  9. }
  10. abstract aspect Y {
  11. abstract pointcut p();
  12. before(): execution(* m(..)) && p() {
  13. System.out.println("In advice()");
  14. }
  15. }
  16. aspect X extends Y {
  17. pointcut p(): if(thisAspectInstance.doit());
  18. boolean doit() {
  19. System.out.println("in doit(): class="+this.getClass().getName());
  20. return true;
  21. }
  22. }