@Immutable public class MsgFormatter extends Object
{} characters.
See the next correct asserts:
assertEquals("TEST" , MsgFormatter.format("TE{}T", "S"));
assertEquals("TE, S, T", MsgFormatter.format("TE", "S", "T"));
assertEquals("TES{}" , MsgFormatter.format("TE{}{}", "S"));
| Modifier and Type | Field and Description |
|---|---|
protected static String |
DEFAULT_MARK
Parameter mark
|
protected static char |
SEPARATOR
Separator of unmarked arguments '{}' was changed to a single space from release 1.91
|
| Modifier | Constructor and Description |
|---|---|
protected |
MsgFormatter()
Static methods are available only
|
protected |
MsgFormatter(String mark)
Static methods are available only
|
| Modifier and Type | Method and Description |
|---|---|
static <T> String |
format(CharSequence messageTemplate,
T... arguments)
Format the message, see the next correct asserts:
assertEquals("TEST" , MsgFormatter.format("TE{}T", "S"));
assertEquals("TE S T", MsgFormatter.format("TE", "S", "T"));
assertEquals("TES{}" , MsgFormatter.format("TE{}{}", "S"));
|
static <T> String |
format(T... templateAndArguments)
Format the message from Object array
|
<T> String |
formatMsg(CharSequence messageTemplate,
T... argumentValues)
Format the message, see the next correct asserts:
assertEquals("TEST" , MsgFormatter.format("TE{}T", "S"));
assertEquals("TE, S, T", MsgFormatter.format("TE", "S", "T"));
assertEquals("TES{}" , MsgFormatter.format("TE{}{}", "S"));
|
protected <T> String |
formatMsg(T... templateAndArguments)
Format the message from Object array
|
protected static PrintWriter |
getPrintWriter(Appendable appendable)
Convert appendable to object type of PrintWriter
|
protected void |
writeValue(Object value,
StringBuilder out,
boolean marked)
Print argument to the Writter with an optional format.
|
protected static final String DEFAULT_MARK
protected static final char SEPARATOR
@Nonnull public <T> String formatMsg(@Nullable CharSequence messageTemplate, @Nullable T... argumentValues)
assertEquals("TEST" , MsgFormatter.format("TE{}T", "S"));
assertEquals("TE, S, T", MsgFormatter.format("TE", "S", "T"));
assertEquals("TES{}" , MsgFormatter.format("TE{}{}", "S"));
messageTemplate - Template where argument position is marked by the {} characters.argumentValues - Optional arguments, where the Supplier interface is supported.@Nullable protected <T> String formatMsg(@Nullable T... templateAndArguments)
templateAndArguments - The first item is a template where parameters are located by "{}"
text and the next arguments are optional parameters of the template.null.protected void writeValue(@Nullable Object value, @Nonnull StringBuilder out, boolean marked)
out - Writervalue - Value where the Supplier interface is supported.@Nonnull public static <T> String format(@Nullable CharSequence messageTemplate, @Nullable T... arguments)
assertEquals("TEST" , MsgFormatter.format("TE{}T", "S"));
assertEquals("TE S T", MsgFormatter.format("TE", "S", "T"));
assertEquals("TES{}" , MsgFormatter.format("TE{}{}", "S"));
messageTemplate - Template where argument position is marked by the {} characters.arguments - Optional arguments, where the Supplier interface is supported.@Nullable public static <T> String format(@Nullable T... templateAndArguments)
templateAndArguments - The first item is a template where parameters are located by "{}".
The Supplier interface is supported.
text and the next arguments are optional parameters of the template.null.@Nonnull protected static PrintWriter getPrintWriter(@Nonnull Appendable appendable)
Copyright 2019-2022, Pavel Ponec