| Author |
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............
|
OCPJP(83%)
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
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:
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: annotation problem.
|
|
|