public @interface InnerAnnotation {
String value() default "hello";
}
public @interface OuterAnnotation {
InnerAnnotation value() default ???
}
还有一个案例:
public @interface AnotherOuterAnnotation {
InnerAnnotation[] value() default ??? UPD: {}
}
最佳答案
是的,有可能:
public @interface InnerAnnotation {
String value() default "hello";
}
public @interface OuterAnnotation {
InnerAnnotation value() default @InnerAnnotation(value = "Goodbye");
}
关于java - 是否可以为另一种注释类型的注释字段指定默认值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9153177/