I'm trying to do something like the following:
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface AnnotationOne {
boolean annotationTwoToggler() default false
{
if (annotationTwoToggler) {
// Apply annotation AnnotationTwo to calling type
}
}
}
An example of how I would use this:
@AnnotationOne(true) // Implies AnnotationTwo
public class MyClass { ... }
AnnotationTwo
and its implementations are in the API that I'm using, and cannot be changed. I want to cause all implementations of AnnotationTwo
to trigger given a true
parameter to AnnotationOne
.
How can I do this?