• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Don't really Understand what Annotations Are all about

 
Kevin Simonson
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20493
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Clapham
Sheriff
Pie
Posts: 20725
30
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic