Over a million developers have joined DZone.

An Eclipse Template for Creating Annotations

· Java Zone

Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code! Brought to you in partnership with ZeroTurnaround.

If/when you start doing Java EE 6 (spec lead from Oracle insisted that I use this means of referring to the latest release, by telling me that JEE6 does not exist, which I took some philosophical amusement in, given that language is not often about an arbiter making an existential argument for the referent), you will be making a lot of annotations. Repositories, qualifiers for injections, etc.

The Weld archetype comes with a bunch in place that I noted use static imports for the constants that are required. If you then go and make your own, since eclipse‘s import mechanism is still not bright enough to deal with static imports, you will no doubt end up with ElementType and RetentionPolicy clogging up your already seriously ugly declaration space.

So here is a template that just makes the whole annotation, including the package statement, and then drops you into the JavaDoc block where you can state your intentions and move on.

XML of eclipse template

 

From http://www.jroller.com/robwilliams/entry/an_eclipse_template_for_creating

The Java Zone is brought to you in partnership with ZeroTurnaround. Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code!

Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}