I\'m a little new to the Java 5 annotations and I\'m curious if either of these are possible:
This annotation would generate a simple getter and setter for you.
Is there a way to use annotations in Java to replace accesssors?
In short, no, the Java 5/6 compiler does not support this and it would be difficult for third parties to add such support in a compiler-agnostic manner.
To get a better handle on annotations, I'd start with JUnit. If you write code for versions 3 (pre-annotations) and 4 (annotation-based), you quickly get a handle on how the framework replaced a contract based on naming patterns with one that was annotation-based.
For a more dramatic example, compare EJB 2 with EJB 3.