I presented a talk on Java Annotations to the Columbia, Maryland Java Users Group on 1/19/2010. This page contains links to a video recording of the talk and the source code that I wrote during the talk.
I hope you find it informative, entertaining and useful!
Note: I'm adding more videos as I get time. Subscribe to my RSS feed to be notified.
I've uploaded the following videos to vimeo. Each is listed below with a short description. I recommend you watch them in order as they assume knowledge of previous videos.
Java Annotations by Scott Stanchfield is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.
Feel free to watch the videos and point friends to them, but you cannot use them as part of any commercial product nor can you create derivative works. Follow the link above to see the complete license text.
- Part 1 - Introduction -
Introduction to Java Annotations (what they are and why you would use them).
- Part 2 - Classfile Annotations -
Creating annotations that are kept in the generated class files but not loaded in the VM at runtime.
- Part 3 - Runtime Annotations 1 -
Example of annotating methods with a custom @Test annotation to run in a test runner similar to junit.
- Part 4 - Runtime Annotations 2 -
Example of annotating methods to be used as actions that are triggered from buttons in a user interface.
- Part 5 - Code Generation 1 -
Writing an annotation processor that runs at compile time to generate an RMI interface from a standard interface.
- Part 6 - Code Generation 2 -
Using an annotation processor to generate JavaBean boilerplate code.
Here is the sample code I wrote during the lecture. Note that this code is not intended for production use.
All sample code is licensed under the Eclipse Public License, version 1.0.
See http://www.eclipse.org/legal/epl-v10.html for details.