@Documented
@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface PersistText
Non-translatable Strings
The annotation is declared on one of the accessor methods for the text field. Assuming a property name of MyLongText, this would look like:
@PersistText(translatable=false)
String getMyLongText();
java.io.Reader getMyLongTextAsStream();
Either one or both of these methods can be declared, and the @PersistText annotation must be declared on exactly one of them. In addition to the accessors, any combination of the following mutators can be supplied (and in practice at least one must be supplied, although this is not enforced):
void setMyLongText(String s);
void setMyLongText(java.io.Reader r);
Translatable Strings
The annotation is declared on one of the accessor methods for the text field. Assuming a property name of MyLongText, this would look like:
@PersistText(translatable=true)
String getMyLongText(java.util.Locale l);
java.io.Reader getMyLongTextAsStream(java.util.Locale l);
Either one or both of these methods can be declared, and the @PersistText annotation must be declared on exactly one of them. Note that callers must specify the locale they want. The API will return the string in the locale that best matches the requested locale (this might be the root locale). Callers specify Locale.ROOT to get the base (default) translation. In addition to the accessors, any combination of the following mutators can be supplied:
void setMyLongText(String s, java.util.Locale l);
void setMyLongText(java.io.Reader r, java.util.Locale l);
The text will be stored against the specific locale that is passed in. To set the base (default) translation, specify Locale.ROOT.
Modifier and Type | Optional Element and Description |
---|---|
boolean |
shortText
Whether the text is short.
|
boolean |
translatable
Whether the text supports translations
|