Platinum Partner
java,tools & methods

An Eclipse Template for Creating Annotations

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

{{ tag }}, {{tag}},

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

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}