File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes annotation problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "annotation problem." Watch "annotation problem." New topic

annotation problem.

ankur trapasiya
Ranch Hand

Joined: Sep 24, 2010
Posts: 160

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

Joined: Oct 27, 2005
Posts: 20049

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:

How To Ask Questions How To Answer Questions
It is sorta covered in the JavaRanch Style Guide.
subject: annotation problem.
It's not a secret anymore!