1
0
şunun yansıması https://github.com/eclipse-aspectj/aspectj.git eşitlendi 2024-09-03 17:56:34 +02:00
org.aspectj/tests/new/AfterReturningResult.java
2002-12-16 18:51:06 +00:00

33 satır
742 B
Java

public class AfterReturningResult {
public static void main (String[] args) {
new CFCommandProcessor().run();
}
}
class CFCommand {
void handleResponse() {}
void updateCache() { System.err.println("updating cache");} }
class CFCommandProcessor {
public void run() {
new CFCommand().handleResponse();
}
}
aspect A {
pointcut response(CFCommand cmd) : within(CFCommandProcessor) &&
target(cmd) &&
call(void CFCommand.handleResponse (..));
after(CFCommand cmd) returning: response(cmd) {
cmd.updateCache();
}
}
aspect B {
Object around(): execution(void run()) {
return proceed();
}
}