Skip to main content
10 events
when toggle format what by license comment
S Oct 15, 2019 at 1:24 history suggested Adriano CC BY-SA 4.0
Improved grammar
Oct 15, 2019 at 0:25 review Suggested edits
S Oct 15, 2019 at 1:24
Mar 23, 2016 at 11:08 comment added Terry Its an old post but still if you want to access value of your annotation's attribute you can use the following code: Field[] fields = Test.class.getDeclaredFields(); for (Field field : fields) { if(field.isAnnotationPresent(FieldDescr.class)){ MyAnnotation myAnnotation = field.getAnnotation(MyAnnotation.class); System.out.println(myAnnoatation.name()); } } In the above example name is the attribute of MyAnnotion which is an annotation interface.
Jun 3, 2015 at 3:47 answer added Aaron timeline score: 15
Dec 3, 2013 at 22:26 vote accept Jianwu Chen
Dec 3, 2013 at 22:23 comment added Jianwu Chen Thanks. It works. The annotation interface is not following java bean naming convention, so when I try getXXX, I didn't find this method. For the attributes. it's also not following java bean naming convention, I have to use special logic to find the attributes reflectively. I have implemented it using reflection.
Dec 3, 2013 at 22:15 review First posts
Dec 3, 2013 at 22:15
Dec 3, 2013 at 22:12 answer added kapex timeline score: 87
Dec 3, 2013 at 21:59 comment added isnot2bad What's wrong with field.getAnnotations()? You can easily determine the annotation class by calling 'annotationType()' on each Annotation object.
Dec 3, 2013 at 21:53 history asked Jianwu Chen CC BY-SA 3.0