|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object logahawk.formatters.FormatterSigFormatter
@Immutable public class FormatterSigFormatter
Formats a String
that can be formatted by a Formatter
, using the arguments that follow the
formattable String
.
A formattable String
is one that contains one or more format specifiers conforming to the rules defined by
Formatter
(i.e. "%[argument_index$][flags][width][.precision]conversion"). When such a String
is
found, this object will pull the formattable String
and its arguments out of the signature and replace them
with the formatted String
.
Because this replaces arguments, it is highly suggested that there be no arguments specified that will not be used in
formatting, as you might get unexpected results -- namely extra text in your log message.
This formatter is not added by Utils.addStandardFormatters(SimpleLogger)
because its behavior could be
surprising to developers if they are are not aware of its inclusion. This formatter is very powerful and is highly
recommended, but I did not feel it fair to make it standard in the current version.
Field Summary | |
---|---|
protected static String |
formatSpecifier
Copied from java\lang\Formatter.java |
protected Pattern |
pattern
|
Constructor Summary | |
---|---|
FormatterSigFormatter()
|
Method Summary | |
---|---|
boolean |
canFormat(List<Object> arguments)
This should return true only if this "Formatter" can provide a useful formatting for this signature. |
int |
countFormatArguments(String s)
Counts the number of arguments that the provided String will use. |
void |
format(List<Object> arguments)
This will re-arrange and alter the signature provided into a new signature. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String formatSpecifier
protected final Pattern pattern
Constructor Detail |
---|
public FormatterSigFormatter()
Method Detail |
---|
public boolean canFormat(List<Object> arguments)
SignatureFormatter
canFormat
in interface SignatureFormatter
public void format(List<Object> arguments)
SignatureFormatter
format
in interface SignatureFormatter
public int countFormatArguments(String s)
String
will use.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |