|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlogahawk.formatters.AbstractArgumentFormatter
logahawk.formatters.CollectionArgFormatter
logahawk.formatters.AbstractCollectionArgFormatter
@Immutable public abstract class AbstractCollectionArgFormatter
Abstract base class for ArgumentFormatter
s that writes each object in the Collection
s on a single
line. This is a sibling class to ConcatCollectionArgFormatter
, which is best suited for formatting objects
into a single-line.
The output is of the form:
Header Item Item Item ... FooterThe header and footer are output only if there is at least one item. If there is only one item, the flag
formatSingleSpecial
will be used to determine behavior.
Field Summary | |
---|---|
protected ConcatCollectionArgFormatter |
concat
Used to merge the formatted lines into one big String with the appropriate new lines. |
protected boolean |
formatSingleSpecial
If true this will format a list with a single object using formatSingleObj(Object, Collection, int)
without any call to formatHeader(Collection) or formatFooter(Collection, int) . |
protected int |
maxItems
Signals the maximum number of items to display. |
Fields inherited from class logahawk.formatters.AbstractArgumentFormatter |
---|
indentor |
Constructor Summary | |
---|---|
protected |
AbstractCollectionArgFormatter(boolean formatSingleSpecial,
int maxItems)
|
Method Summary | |
---|---|
protected String |
formatFooter(Collection<?> coll,
int numUsed)
Returns a footer string, which will be the last item displayed. |
protected String |
formatHeader(Collection<?> coll)
Returns a header string, which will be the first item displayed. |
protected String |
formatList(Collection<?> coll,
Collection<ArgumentFormatter> formatters,
int indentLevel)
|
protected String |
formatObj(Object obj,
int index,
Collection<ArgumentFormatter> formatters,
int indentLevel)
Formats a single object at the provided index. |
protected String |
formatSingleObj(Object obj,
Collection<ArgumentFormatter> formatters,
int indentLevel)
Special formatting request when the collection contains only one item. |
Methods inherited from class logahawk.formatters.CollectionArgFormatter |
---|
canFormat |
Methods inherited from class logahawk.formatters.AbstractArgumentFormatter |
---|
findFormatter, getChildObjectFormat, getIndentor, setIndentor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface logahawk.formatters.ArgumentFormatter |
---|
format |
Field Detail |
---|
protected final ConcatCollectionArgFormatter concat
protected final boolean formatSingleSpecial
formatSingleObj(Object, Collection, int)
without any call to formatHeader(Collection)
or formatFooter(Collection, int)
. A true value
essentially "unpacks" the one item and reacts as if there were no containing list.
protected final int maxItems
formatFooter(Collection, int)
can be used to
display how many items were not logged.
Constructor Detail |
---|
protected AbstractCollectionArgFormatter(boolean formatSingleSpecial, int maxItems)
Method Detail |
---|
protected String formatList(Collection<?> coll, Collection<ArgumentFormatter> formatters, int indentLevel)
protected String formatHeader(Collection<?> coll)
protected String formatFooter(Collection<?> coll, int numUsed)
numUsed
- Number of items actually formatted and displayed.
protected String formatSingleObj(Object obj, Collection<ArgumentFormatter> formatters, int indentLevel)
AbstractArgumentFormatter.getChildObjectFormat(Object, Collection, int)
.
indentLevel
- The indent will be one larger than the caller, there is no need to increment by one.protected String formatObj(Object obj, int index, Collection<ArgumentFormatter> formatters, int indentLevel)
AbstractArgumentFormatter.getChildObjectFormat(Object, Collection, int)
.
index
- The 0-based index of this item in the original collection.indentLevel
- The indent will be one larger than the caller, there is no need to increment by one.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |