我已经声明了这样的注释:
public @interface CustomAnnot
{
String[] author() default "me";
String description() default "";
}
因此有效的注释将是
@CustomAnnot(author="author1", description="test")
我无法弄清楚的是,如何设置多个作者,因为author()返回String []这应该是可能的。
@CustomAnnot(author="author1","autor2", description="test")
不起作用!
答案 0 :(得分:102)
这样做:
public @interface CustomAnnot {
String[] author() default "me";
String description() default "";
}
你的注释:
@CustomAnnot(author={"author1","author2"}, description="test")