My question is related to Java: Annotated Annotations (and passing values), but not entirely the same, so I thought I'd ask anyway. Especially since there were so few answers to that question.
Say I have written an annotation like this:
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface NestedAnnotation {
public String value();
public Class<?> impl() default Void.class;
}
So if I want to use this, I have to do something like @NestedAnnotation("somevalue"). Now, what if I want to put that annotation inside another one:
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@NestedAnnotation("need value here!")
public @interface OuterAnnotation {
public String value();
public Class<?> impl() default Void.class;
}
The NestedAnnotation needs a value, and adding a String (like above) works. But what if I wanted to pass on a value that was received by the OuterAnnotation? Is that possible?