aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/AfterReturningResult.java
blob: 6d963cd649e15405cc21fcaf7bb6deda49bea0f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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();
    }
}