1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
package test;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
public class NestedAnnotations {
@OuterAnno(inner=@InnerAnno(name="inner"))
String field;
@Target({FIELD})
@Retention(RUNTIME)
public static @interface InnerAnno {
String name();
}
@Target({FIELD})
@Retention(RUNTIME)
public static @interface OuterAnno {
InnerAnno inner();
}
}
|