IIIA-Example : Simple

file: Main.java
includes all classes

Joinpointtypes

joinpointtype J {}
joinpointtype K extends J {}
joinpointtype L extends K {}

Classes

class C exhibits J {
	pointcut J : execution(void test());
	void test() {
		System.out.println("C.test()");
	}
}
class D extends C exhibits J, K {
	pointcut J : super; // This PC wil never match except test is overwritten
	pointcut K : execution(void test2());
//	K pointcut : execution(void test2()); // illegal

	void test2() {
		System.out.println("D.test2()");
	}
}
class E extends C exhibits L {
	pointcut L : execution(void test3());
	void test3() {
		System.out.println("E.test3()");
	}
	// new L() {}
}

Aspects

aspect X advises J, K {
  before (J j) {
	  System.out.println("\tbefore: "+thisJoinPoint);
  }
  after (K k) {
	  System.out.println("\tafter: "+thisJoinPoint);
  }
}

Back to main page