Reputation: 405
I have a class Book
which has some annotations like @Override
,@Before
,@After
.
How can I get those annotations using ICompilationUnit
?
Upvotes: 0
Views: 412
Reputation: 2551
Javadoc for IAnnotation states that:
"Annotations are obtained using IAnnotatable.getAnnotation(String).
Note that annotations are not children of their declaring element. To get a list of the annotations use IAnnotatable.getAnnotations()."
What's an IAnnotatable? IField, ILocalVariable, IMethod, IPackageDeclaration, IType.
There are methods on ICompilationUnit for getting objects of those types.
Upvotes: 1