blob: e36de3531133adab9fbb0545ac3d505559b98d4a (
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 java.lang.annotation.*;
enum Store {YES,NO;}
@Retention(RetentionPolicy.RUNTIME)
@interface SearchableProperty { Store store(); }
public class FieldJP {
@SearchableProperty(store=Store.YES)
public static int fieldOne;
@SearchableProperty(store=Store.NO)
public static int fieldTwo;
public static int fieldThree;
public static void main(String[] args) {
System.err.println("fone="+fieldOne);
System.err.println("ftwo="+fieldTwo);
System.err.println("fthr="+fieldThree);
fieldOne = 5;
fieldTwo = 6;
fieldThree = 7;
}
}
aspect X {
before(): get(@SearchableProperty(store=Store.YES) * *) {
System.err.println("get of YES field");
}
before(): get(@SearchableProperty(store=Store.NO) * *) {
System.err.println("get of NO field");
}
before(): set(@SearchableProperty(store=Store.YES) * *) {
System.err.println("set of YES field");
}
before(): set(@SearchableProperty(store=Store.NO) * *) {
System.err.println("set of NO field");
}
}
|