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 intformat(Appendable dest, Object... args) Formats the parsed message with positional arguments.format(Appendable dest, Map<String, Object> argsMap) static final Stringstatic final Stringfreeze()Freezes the object.booleanbooleanbooleanisFrozen()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:FreezableProvides for the clone operation. Any clone is initially unfrozen.- Specified by:
cloneAsThawedin interfaceFreezable<MiniMessageFormatter>
-
freeze
Description copied from interface:FreezableFreezes the object.- Specified by:
freezein interfaceFreezable<MiniMessageFormatter>- Returns:
- the object itself.
-
isFrozen
public boolean isFrozen()Description copied from interface:FreezableDetermines whether the object has been frozen or not.- Specified by:
isFrozenin interfaceFreezable<MiniMessageFormatter>
-