This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

annotation problem.

 
ankur trapasiya
Ranch Hand
Posts: 160
Java Netbeans IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all..

I am assigned a task to develop a custom annotation for database connectivity



Now at a very basic level i have created one annotation but it is not fulfilling my this requirement..can anyone guide me how to develop this type of annotation? I surfed and come to know that to inject an entity like in built annotations we have to use reflections. is it so ?

and there is no tutorial available for this kind of annotation also..
some expert please guide me regarding this ..


Thanks in advance............
 
Rob Spoor
Sheriff
Pie
Posts: 20381
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://download.oracle.com/javase/tutorial/reflect/index.html

I don't know if that's been updated to handle annotations though.
If not, then there are a few methods you need to learn after reading it:
- isAnnotationPresent checks if a specific annotation is present
- getAnnotation returns a specific annotation (or null if not present).

In your case, once you have a java.lang.reflect.Field for field "con" you get its annotation like this:
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic