I have created a meta-annotation and applied it to an annotation but can't find any way to find what meta-annotations are associated with the annotation at runtime. Is this actually supported in JDK 6?
E.g.:
/**
* Meta-annotation for other annotations declaring them to be "filter" annotations
*/
@Target(ElementType.ANNOTATION_TYPE) // make this a meta-annotation
@Retention(RetentionPolicy.RUNTIME) // available at runtime
public @interface Filter
{
}
/**
* Marks a test as only being applicable to TypeOne clients
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Filter
public @interface TypeOne
{
}
public class MyClientClass
{
// Would like to scan this method to see if the method has an Annotation that is of meta-type "Filter"
@TypeOne
public void testMethod()
{
}
}
It's simple to find methods with the "TypeOne" annotation, but once I have that Annotation in hand, how can I, at runtime, find out if that annotation has as associated meta-annotation (i.e., "Filter")?