Class MiniMessageFormatter
java.lang.Object
com.ibm.icu.samples.text.messagepattern.MiniMessageFormatter
- All Implemented Interfaces:
Freezable<MiniMessageFormatter>
,Cloneable
Mini message formatter for a small subset of the ICU MessageFormat syntax.
Supports only string substitution and select formatting.
- Since:
- 2010-aug-21
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionapplyPattern
(String msg) Provides for the clone operation.private int
format
(Appendable dest, Object... args) Formats the parsed message with positional arguments.format
(Appendable dest, Map<String, Object> argsMap) static final String
static final String
freeze()
Freezes the object.boolean
boolean
boolean
isFrozen()
Determines whether the object has been frozen or not.mapFromNameValuePairs
(Object[] args) Presents an array of (String, Object) pairs as a Map.
-
Field Details
-
msg
-
-
Constructor Details
-
MiniMessageFormatter
public MiniMessageFormatter() -
MiniMessageFormatter
-
MiniMessageFormatter
-
-
Method Details
-
applyPattern
-
getPatternString
-
hasNamedArguments
public boolean hasNamedArguments() -
hasNumberedArguments
public boolean hasNumberedArguments() -
format
Formats the parsed message with positional arguments. Supports only string substitution (e.g., {3}) and select format.- Parameters:
dest
- gets the formatted message appendedargs
- positional arguments- Returns:
- dest
-
format
-
format
-
format
-
format
-
mapFromNameValuePairs
Presents an array of (String, Object) pairs as a Map. Only for temporary use for formatting with named arguments. -
cloneAsThawed
Description copied from interface:Freezable
Provides for the clone operation. Any clone is initially unfrozen.- Specified by:
cloneAsThawed
in interfaceFreezable<MiniMessageFormatter>
-
freeze
Description copied from interface:Freezable
Freezes the object.- Specified by:
freeze
in interfaceFreezable<MiniMessageFormatter>
- Returns:
- the object itself.
-
isFrozen
public boolean isFrozen()Description copied from interface:Freezable
Determines whether the object has been frozen or not.- Specified by:
isFrozen
in interfaceFreezable<MiniMessageFormatter>
-