Can someone point me in the appropriate direction to learn the proper use of tagging Information on data with Java Annotations?

I've used them before (@Override, @Deprecated and @SuppressWarnings(sp) ) but I'm interested in creating my own for testing-purposes and possibly for medium-to-big projects. I need to understand when to do it though.

I've tried learning from Sun's tutorial, but I don't think I'm understanding the concept well enough. I don't care too much about the syntax but the general purpose of when Annotations should be used.

-Alex

Recommended Answers

All 2 Replies

I'm sorry, maybe my question wasn't concise enough.

What I'd like to know is the general idea of tagging information on data. What exactly am I doing, sending additional information to the compiler during run-time or compile-time... or both? Is it at all unsafe to use Annotations? Are there things I can do, such as untag checked exceptions, etc?

you already read the sun tutorial? then i would suggest this:

Annotation-based development is certainly one of the latest Java development trends. Annotation-based development relieves Java developers from the pain of cumbersome configuration. Quoting from Sun's official site, "It (annotation-based development) lets us avoid writing boilerplate code under many circumstances by enabling tools to generate it from annotations in the source code. This leads to a declarative programming style where the programmer says what should be done and tools emit the code to do it." Simply speaking, annotation is a mechanism for associating a meta-tag with program elements and allowing the compiler or the VM to extract program behaviors from these annotated elements and generate interdependent codes when necessary. In the first part of this three-article series, I'll describe some basics of annotation, their benefits, as well as some example usages.

EDIT: or the wikipedia article

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.