I have some nonnull variable (e.g. en1) of Enum type. The question is: how to get annotations related to enumeration constant referenced by e
null
en1
e
Try this (java reflection):
String field = En.AAA.name(); En.class.getField(field).getAnnotations();
It should get you the annotations from AAA.
AAA
EDIT:
As the author supposed:
en1.getClass().getField(((Enum)en1).name()).getAnnotations();
Works for him :)