blob: 7199b68e1d5184953a81ba8a547e4ee27058d04a (
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
33
34
35
36
37
38
39
40
41
|
import org.aspectj.lang.annotation.*;
import java.lang.annotation.*;
import java.lang.reflect.*;
import org.aspectj.lang.*;
@Aspect("perthis(transactional())")
public class Code3 {
@Pointcut("execution(@Transactional * * (..))")
public void transactional() { }
@Before("execution(* *(..))")
public void m(JoinPoint.StaticPart thisJoinPointStaticPart) {
System.out.println(thisJoinPointStaticPart);
}
public static void main(String[] args) {
new AAA().m();
new BBB().m();
new CCC().m();
}
}
aspect XXX {
@Transactional public void CCC.m() {}
}
class AAA {
public void m() { }
}
class BBB {
public void m() { }
}
class CCC {
}
@Retention(RetentionPolicy.RUNTIME) @interface Transactional {}
|