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.

Nine.java 490B

12345678910111213141516171819202122232425
  1. public class Nine {
  2. public static void main(String[] argv) {
  3. Nine a = new Nine();
  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. boolean doit() {
  16. System.out.println("in doit(): class="+this.getClass().getName());
  17. return true;
  18. }
  19. }
  20. aspect X extends Y {
  21. pointcut p(): if(thisAspectInstance.doit());
  22. }