|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ArgumentFormatter
This class helps format individual objects (the arguments) provided to the log methods into simple String
messages that can be written to the log.
Most complex objects do not provide helpful String
representations when the "ToString" method is called.
These classes are designed to understand and interpret such objects and return String
messages which can be
easily outputted by the logger.
Note that it is possible to make a ArgumentFormatter
that can handle multiple types of related objects.
Method Summary | |
---|---|
boolean |
canFormat(Object obj)
This should return true only if this can provide a useful formatting for this type of object. |
String |
format(Object obj,
Collection<ArgumentFormatter> formatters,
int indentLevel)
This converts the object into a String that represent the object. |
Method Detail |
---|
boolean canFormat(Object obj)
String format(Object obj, Collection<ArgumentFormatter> formatters, int indentLevel)
String
that represent the object. The String
may contain line
breaks, but should not include a trailing line break. The first line of the result should NOT include any
indentation, that should be handled by the calling class.
If the object is complex and contains other objects, this ArgumentFormatter
may use the provided list of
ArgumentFormatter
objects to find a more appropriate formatter.
To make things look nice, the "indentLevel" is provided. The indent level should always be incremented by one when
calling downward into other ArgumentFormatter
s.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |