@Immutable public class ValueFormatter extends MsgFormatter
{} 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 String |
valueBorder
Border of the byte array
|
DEFAULT_MARK, SEPARATOR| Modifier | Constructor and Description |
|---|---|
protected |
ValueFormatter()
Static methods are available only
|
protected |
ValueFormatter(String mark,
String textBorder)
Static methods are available only
|
| Modifier and Type | Method and Description |
|---|---|
static <T> String |
format(String 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 |
formatSql(String sqlTemplate,
T... arguments)
Format the SQL where makup character is
'?'. |
protected int |
getSizeLimit()
Default lenhth is 32
|
protected void |
writeByteArray(byte[] bytes,
StringBuilder out)
Write bytes as hexa
|
protected void |
writeLongValue(CharSequence value,
StringBuilder out)
You can call the method from a child class
|
protected void |
writeValue(Object value,
StringBuilder out,
boolean marked)
Print argument to the Writter with an optional format.
|
format, format, formatMsg, formatMsg, getPrintWriterprotected final String valueBorder
protected void writeValue(@Nullable Object value, @Nonnull StringBuilder out, boolean marked)
writeValue in class MsgFormatterout - Writervalue - A one value where the Supplier interface is supported.protected void writeByteArray(@Nonnull byte[] bytes, @Nonnull StringBuilder out)
protected void writeLongValue(@Nonnull CharSequence value, @Nonnull StringBuilder out)
protected int getSizeLimit()
@Nonnull public static <T> String format(@Nullable String 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@Nonnull public static <T> String formatSql(@Nullable String sqlTemplate, @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"));
sqlTemplate - SQL template where argument position is marked by the '?' characters.arguments - Optional argumentsCopyright 2019-2022, Pavel Ponec