|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object logahawk.formatters.AbstractArgumentFormatter logahawk.formatters.CollectionArgFormatter logahawk.formatters.ArrayArgFormatter
@Immutable public class ArrayArgFormatter
Formats arrays of objects using a wrapped CollectionArgFormatter
. Arrays are not truly Iterable
, so
this wrapper class "unpacks" the array and passes the objects to the CollectionArgFormatter
. This will only
handle arrays that are 4 dimensions or less.
Field Summary | |
---|---|
protected CollectionArgFormatter |
collectionArgFormatter
Used to format the objects after unpacking |
Fields inherited from class logahawk.formatters.AbstractArgumentFormatter |
---|
indentor |
Constructor Summary | |
---|---|
ArrayArgFormatter()
Uses a MultiLineCollectionArgFormatter for collectionArgFormatter . |
|
ArrayArgFormatter(CollectionArgFormatter collectionArgFormatter)
|
Method Summary | |
---|---|
boolean |
canFormat(Object obj)
Formats anything that implements Iterable . |
String |
format(Object obj,
Collection<ArgumentFormatter> formatters,
int indentLevel)
This converts the object into a String that represent the object. |
protected void |
unpackDoubleDimensionArray(Object obj,
List<Object> list,
Collection<ArgumentFormatter> formatters,
int indentLevel,
Character arrayType)
Double-dimension arrays are fairly common in 2D application.s |
protected void |
unpackQuadDimensionArray(Object obj,
List<Object> list,
Collection<ArgumentFormatter> formatters,
int indentLevel,
Character arrayType)
Four dimensions is common for programs that use quaternions. |
protected void |
unpackSingleDimensionArray(Object obj,
List<Object> list,
Collection<ArgumentFormatter> formatters,
int indentLevel,
Character arrayType)
|
protected void |
unpackTripleDimensionArray(Object obj,
List<Object> list,
Collection<ArgumentFormatter> formatters,
int indentLevel,
Character arrayType)
Triple-dimension arrays are often used for Vectors and 3-dimensional matricies |
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 |
Field Detail |
---|
protected final CollectionArgFormatter collectionArgFormatter
Constructor Detail |
---|
public ArrayArgFormatter()
MultiLineCollectionArgFormatter
for collectionArgFormatter
.
public ArrayArgFormatter(CollectionArgFormatter collectionArgFormatter)
Method Detail |
---|
public boolean canFormat(Object obj)
CollectionArgFormatter
Iterable
.
canFormat
in interface ArgumentFormatter
canFormat
in class CollectionArgFormatter
public String format(Object obj, Collection<ArgumentFormatter> formatters, int indentLevel)
ArgumentFormatter
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.
protected void unpackDoubleDimensionArray(Object obj, List<Object> list, Collection<ArgumentFormatter> formatters, int indentLevel, Character arrayType)
protected void unpackQuadDimensionArray(Object obj, List<Object> list, Collection<ArgumentFormatter> formatters, int indentLevel, Character arrayType)
protected void unpackSingleDimensionArray(Object obj, List<Object> list, Collection<ArgumentFormatter> formatters, int indentLevel, Character arrayType)
protected void unpackTripleDimensionArray(Object obj, List<Object> list, Collection<ArgumentFormatter> formatters, int indentLevel, Character arrayType)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |