mirror of
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-08-14 02:10:40 +02:00
31 lines
619 B
Java
31 lines
619 B
Java
import org.aspectj.testing.Tester;
|
|
|
|
public class AroundAndCalls {
|
|
public static void main(String[] args) {
|
|
Tester.checkEqual(new CL().go(), "basic-advised");
|
|
}
|
|
}
|
|
|
|
aspect MustAspect /*of eachobject(instanceof(CL))*/ {
|
|
|
|
pointcut parseCalls(CP cp, String cmd):
|
|
(args(cmd) && target(cp) && call(String CP.parse(String))) &&
|
|
within(CL);
|
|
|
|
String around(CP cp, String cmd): parseCalls(cp, cmd) {
|
|
return proceed(cp, cmd + "-advised");
|
|
}
|
|
}
|
|
|
|
class CL {
|
|
String go() {
|
|
return new CP().parse("basic");
|
|
}
|
|
}
|
|
|
|
class CP {
|
|
String parse(String cmd) {
|
|
return cmd;
|
|
}
|
|
}
|