开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜