logahawk.formatters
Class AbstractArgumentFormatter
java.lang.Object
logahawk.formatters.AbstractArgumentFormatter
- All Implemented Interfaces:
- ArgumentFormatter
- Direct Known Subclasses:
- CollectionArgFormatter, ParentObjectArgFormatter, SwingArgFormatter, ThrowableArgFormatter, XmlNodeArgFormatter
@ThreadSafe
public abstract class AbstractArgumentFormatter
- extends Object
- implements ArgumentFormatter
Useful base class for ArgumentFormatter
s.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
indentor
protected AtomicReference<Indentor> indentor
AbstractArgumentFormatter
protected AbstractArgumentFormatter()
getIndentor
public Indentor getIndentor()
- The
Indentor
used by this class. The default value is SimpleIndentor.SPACE_4
.
setIndentor
public void setIndentor(Indentor indentor)
findFormatter
protected ArgumentFormatter findFormatter(Object obj,
Collection<ArgumentFormatter> formatters)
- Returns the first
ArgumentFormatter
whose canFormat() returns true for the provided object. This may return
null if no ArgumentFormatter
can be found.
getChildObjectFormat
protected String getChildObjectFormat(Object obj,
Collection<ArgumentFormatter> formatters,
int indentLevel)
- Formats the provided object using the provided
ArgumentFormatter
s. This will use findFormatter() to find
the ArgumentFormatter
that will be used. This will return null if no ArgumentFormatter is found.
- Parameters:
indentLevel
- This will likely be 1 or greater since it will be used to format child objects. (The first
object would have the value 0 from the Logger
or ArgumentFormatterContainer
.)- See Also:
Indentor