Package ch.tocco.nice2.textresources.api
Class TextMessage
java.lang.Object
ch.tocco.nice2.textresources.api.TextMessage
- All Implemented Interfaces:
Serializable
Represents a text.
Example usage:
```
TextMessage m = new TextMessage("my.key").setVar("name", obj);
String s = textResources.formatTextMessage(m);
```
- See Also:
-
Constructor Summary
ConstructorDescriptionTextMessage
(@Nullable String module, String key) TextMessage
(String key) TextMessage
(String key, Map<String, Object> vars) -
Method Summary
Modifier and TypeMethodDescriptionboolean
getKey()
getVars()
int
hashCode()
boolean
Tells if a module name is present.boolean
hasVars()
Tells if this object has any variables that should be replaced in the text message's placeholders.Sets/overwrites a variable for this message with the given key.void
toString()
-
Constructor Details
-
TextMessage
-
TextMessage
-
TextMessage
-
-
Method Details
-
setVar
Sets/overwrites a variable for this message with the given key.If such a placeholder in the message template is found then it will be replaced with the string representation of this value. The value may become localized.
- Returns:
- this
-
hasVars
public boolean hasVars()Tells if this object has any variables that should be replaced in the text message's placeholders. -
getVars
-
hasModule
public boolean hasModule()Tells if a module name is present. -
getKey
-
setVars
-
getModule
-
toString
-
equals
-
hashCode
public int hashCode()
-