Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. package com.example.utils.resource;
  2.  
  3. import java.lang.annotation.Retention;
  4. import java.lang.annotation.Target;
  5.  
  6. import static java.lang.annotation.ElementType.FIELD;
  7. import static java.lang.annotation.RetentionPolicy.RUNTIME;
  8.  
  9. /**
  10. * Annotation to mark a field to be populated via JSON java resource.<br/>
  11. *<br/>
  12. * Use {@link JsonResourceInitialiser#initAnnotations(Object)} to load the resource.<br/>
  13. * (Passing a {@link Class} populates static fields)<br/>
  14. *<br/>
  15. * The JSON file should be under the same package as the class to load from.<br/>
  16. *<br/>
  17. * Typical usage would be for data around the networking layer or objects that use JSON.<br/>
  18. */
  19. @Retention(RUNTIME)
  20. @Target(FIELD)
  21. public @interface JsonResource {
  22.  
  23. String fileName();
  24.  
  25. /** optionally specify a class that is in the same package as the desired resource */
  26. Class<?> pathClass() default Void.class;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement