blob: 93af416c860d6badb51d62fa3e6f5bf9c6544ceb (
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
|
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
@Aspect
class AbstractTracer
{
@Pointcut("(execution(public * Foo.anotherMethod*(..)) || execution(public * Foo.methodA(..))) && this(obj)")
protected void methodExec(Object obj){};
@Before("methodExec(obj)")
public void beforeMethodExec(JoinPoint thisJoinPoint, Object obj) {
System.out.println("Before " + thisJoinPoint.getSignature().toString());
}
}
class Foo {
public void methodA() {
}
public void anotherMethod() {
}
}
|