Annotation Type StringDef
@Retention(SOURCE)
public @interface StringDef
Defines a character string constant.
This annotation is used within a StringPool annotation to define
a single character string constant.
A character string constant can be defined in one of the two following ways:
- With a name and a value expressed as
a Java string literal (as defined by the Java Language Specification).
For example:
@StringDef(name = "Hello", value = "Hello California!") - With a name and a reference to another
string constant (typically defined in another library package) using its
fully-qualified name.
For example:
@StringDef(name = "S2", reference = "com.sun.jcclassic.samples.stringlib.LibStrings.Hello")
- Since:
- 3.0.4
- See Also:
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionjava.lang.StringThe name of the defined string constant. -
Optional Element Summary
Optional Elements
-
Element Details
-
name
java.lang.String nameThe name of the defined string constant.- Returns:
- -
-
value
java.lang.String valueThe literal value of the defined string constant.This attribute is exclusive of the
reference()attribute. The annotation processor will fail with an error message if both thevalue()andreference()attributes are defined.- Returns:
- -
- Default:
""
-
reference
java.lang.String referenceThe fully-qualified name of the referenced string constant.This attribute is exclusive of the
value()attribute. The annotation processor will fail with an error message if both thevalue()andreference()attributes are defined.- Returns:
- -
- Default:
""
-