Take note, though — the shorthand version is available only if the annotation type has a single-member variable named value.
不过要注意,只有当注释类型只有一个成员变量,而且变量名为value时,才能使用简写形式。
Listing 3 defines a string named value that the annotation type can accept. You then use the annotation type as in Listing 4.
清单3定义了一个名为value的字符串,该注释类型能够接受它。
You can then treat each named value as an instance of that class, providing you with compile-time type safety that a named set of integers can't.
然后,可以将每个指定的值看作是那个类的一个实例,这为您提供了指定的整数集合所无法提供的编译时类型安全。
Each declaration is actually calling a method named Value that takes a string argument.
每一个声明实际上都调用了一个名为Value的方法,它接受一个字符串参数。
Each declaration is actually calling a method named Value that takes a string argument.
每一个声明实际上都调用了一个名为Value的方法,它接受一个字符串参数。
应用推荐