Accessing annotations defined in the interface, in the class implementing it?
I'm working with java. I 开发者_如何学Chave an interface that has an annotated method in it. Is there a way to access that annotation in a class implementing that interface?
Thanks.
Edit: sorry, I shoudl've been clearer: I'm using reflection to access elements of Java, and I'm wondering how to access the annotations in a class implementing an interface (where the annotation is declared).
Sure. Reflection allows you to check for the presence of an annotation. There are methods at the class, method, paramter levels: reflection and annotations
精彩评论