I created a meta annotation and applied it to the annotation, but cannot find a way to find which meta annotations are associated with the annotation at runtime. Is this really supported in JDK 6?
eg:.
@Target(ElementType.ANNOTATION_TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Filter
{
}
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Filter
public @interface TypeOne
{
}
public class MyClientClass
{
@TypeOne
public void testMethod()
{
}
}
It’s easy to find methods with the “TypeOne” annotation, but as soon as I get this annotation in my hand, how can I find out at runtime whether this annotation has a related meta-annotation (ie, “Filter”)?
source
share