You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FieldJP.java 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import java.lang.annotation.*;
  2. enum Store {YES,NO;}
  3. @Retention(RetentionPolicy.RUNTIME)
  4. @interface SearchableProperty { Store store(); }
  5. public class FieldJP {
  6. @SearchableProperty(store=Store.YES)
  7. public static int fieldOne;
  8. @SearchableProperty(store=Store.NO)
  9. public static int fieldTwo;
  10. public static int fieldThree;
  11. public static void main(String[] args) {
  12. System.err.println("fone="+fieldOne);
  13. System.err.println("ftwo="+fieldTwo);
  14. System.err.println("fthr="+fieldThree);
  15. fieldOne = 5;
  16. fieldTwo = 6;
  17. fieldThree = 7;
  18. }
  19. }
  20. aspect X {
  21. before(): get(@SearchableProperty(store=Store.YES) * *) {
  22. System.err.println("get of YES field");
  23. }
  24. before(): get(@SearchableProperty(store=Store.NO) * *) {
  25. System.err.println("get of NO field");
  26. }
  27. before(): set(@SearchableProperty(store=Store.YES) * *) {
  28. System.err.println("set of YES field");
  29. }
  30. before(): set(@SearchableProperty(store=Store.NO) * *) {
  31. System.err.println("set of NO field");
  32. }
  33. }