File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Don't really Understand what Annotations Are all about Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Don Watch "Don New topic
Author

Don't really Understand what Annotations Are all about

Kevin Simonson
Ranch Hand

Joined: Oct 22, 2011
Posts: 113
Is there some place on the web I can go to understand annotations? I really have no idea what they're about. I look in my existing code and see "@GET" and "@Produces" and "@Path" and "@Context" and "@PathParam", and I just scratch my head and think, "Huh?" Is there some place I can go where the idea gets explained for beginners?

Kevin Simonson
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

You can start with http://docs.oracle.com/javase/tutorial/java/javaOO/annotations.html.
However, you won't find the annotations you mentioned there. Those are part of Java EE, and help in setting up RESTful web services. You can find out more about these by looking at their Javadoc pages. You can find all of those except Context in the javax.ws.rs package.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18649
    
    8

"Start with..." is right; that tutorial is pretty sparse. It doesn't really answer the questions "Why would I want to make my own annotations anyway?" and "Okay, suppose I made an annotation, how would I work with it?"
Poornachandra Sarang
author
Greenhorn

Joined: Apr 17, 2012
Posts: 27
I have provided a detailed treatment on annotations including custom annotations, annotating an annotation, and inheriting annotations. All these concepts are explained with appropriate code. It does provide answers to questions like why create your own annotations and many more. I am not sure whether I am allowed to reproduce some text from the book without a prior permission from the publisher.

ps: As pointed out by Rob, the annotations that you are looking for are not part of Java SE and are thus not covered in the book.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Don't really Understand what Annotations Are all about