public class MessageComposer extends Object
Example:
base messgage - "Base message where {0} markers {1} with given {2}"
args - [several, replaced, arguments]
Result:
"Base message where several markers replaced with given arguments"
| Modifier and Type | Method and Description |
|---|---|
static String |
compose(String baseMsg,
Object... args)
Simple message composer, supports up to 10 markers (0 through 9),
represented as numbers in curly braces, like
{0} or {1} |
public static String compose(String baseMsg, Object... args)
{0} or {1}
See example at the Type level
Currently there are no support for escape character '\', so just don't use curly braces elsewhere except for markers.
baseMsg - the base message with {index} markersargs - Corresponding arguments. Method toString will be invoked
on them. If argument is null the word 'null' is printedIllegalArgumentException - if incorrect number of arguments or no arguments
provided, or unrecognized markers used