code_junkie

Is there a way to use annotations in Java to replace accessors?

Nov 12th, 2011
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. @attribute
  2. private String var = "";
  3.  
  4. /*
  5. * @param s @NotNull
  6. */
  7. public void setString(String s){
  8. ...
  9. }
  10.  
  11. package sample;
  12. import com.javadude.annotation.Bean;
  13. import com.javadude.annotation.Property;
  14. import com.javadude.annotation.PropertyKind;
  15.  
  16. @Bean(properties={
  17. @Property(name="name"),
  18. @Property(name="phone", bound=true),
  19. @Property(name="friend", type=Person.class, kind=PropertyKind.LIST)
  20. })
  21. public class Person extends PersonGen {}
Add Comment
Please, Sign In to add comment