@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,
Appendable out)
Write bytes as hexa
|
protected void |
writeLongValue(CharSequence value,
Appendable out)
You can call the method from a child class
|
protected void |
writeValue(Object value,
Appendable out,
boolean marked)
Print argument to the Writter with an optional format.
|
format, format, formatMsg, formatMsg
protected final String valueBorder
protected void writeValue(@Nullable Object value, @Nonnull Appendable out, boolean marked) throws IOException
writeValue
in class MsgFormatter
out
- Appendablevalue
- A one value where the Supplier
interface is supported.IOException
protected void writeByteArray(@Nonnull byte[] bytes, @Nonnull Appendable out) throws IOException
IOException
protected void writeLongValue(@Nonnull CharSequence value, @Nonnull Appendable out) throws IOException
IOException
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