如何在Java注释中设置string数组
我已经宣布了这样一个注释:
public @interface CustomAnnot { String[] author() default "me"; String description() default ""; } 因此有效的注释将是
 @CustomAnnot(author="author1", description="test") 
我想不出的是,如何设置多个作者,因为author()已经返回String []这应该是可能的。
 @CustomAnnot(author="author1","autor2", description="test") 
不起作用!
像这样做:
 public @interface CustomAnnot { String[] author() default "me"; String description() default ""; } 
而你的注释:
  @CustomAnnot(author={"author1","author2"}, description="test")