blob: 8c19ca4355a6e927856bdf0e974dae0dcd613bf9 (
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
|
import java.io.Serializable;
import java.lang.annotation.*;
import java.lang.*;
class Bean implements Serializable{
private String name;
public String getName() {
return name;
}
@propertyChanger()
public void setName( String name ) {
this.name = name;
}
}
@Retention( RetentionPolicy.RUNTIME )
@Target({ ElementType.METHOD })
@interface propertyChanger {
}
aspect pr108245 {
public static void main(String[] args) {
Bean b = new Bean();
b.setName("hasBean");
}
pointcut callSetter( Bean b )
: call( @propertyChanger * *(..) ) && target( b );
before(Bean b) : callSetter(b) {
System.out.println("before " + b);
}
}
|