I have an interface like this:
public interface IFoo{ @AnnotationTest(param="test") String invoke(); }
and I implement it as follows:
public class Foo implements IFoo{ @Override public String invoke(){ Method method = new Object() { }.getClass().getEnclosingMethod(); AnnotationTest ann = method.getAnnotation(AnnotationTest.class); if(ann == null){ System.out.printl("Parent method annotation is unreachable...") } } }
If you can get the parent annotation, I want to know its way.
Any help or idea would be appreciated.
java
ibrahimyilmaz
source share