|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.unitils.core.util.ArrayAndCollectionFormatter
public class ArrayAndCollectionFormatter
Helper class for generating a string representation of a collection or array.
Field Summary | |
---|---|
protected int |
maxNrOfElements
|
protected ObjectFormatter |
objectFormatter
|
Constructor Summary | |
---|---|
ArrayAndCollectionFormatter(int maxNrOfElements,
ObjectFormatter objectFormatter)
Creates a formatter with the given maximum nr of elements. |
Method Summary | |
---|---|
void |
formatArray(Object array,
int currentDepth,
StringBuilder result)
Formats the given array. |
protected void |
formatBooleanArray(boolean[] array,
StringBuilder result)
|
protected void |
formatByteArray(byte[] array,
StringBuilder result)
|
protected void |
formatCharArray(char[] array,
StringBuilder result)
|
void |
formatCollection(Collection<?> collection,
int currentDepth,
StringBuilder result)
Formats the given collection. |
protected void |
formatDoubleArray(double[] array,
StringBuilder result)
|
protected void |
formatFloatArray(float[] array,
StringBuilder result)
|
protected void |
formatIntArray(int[] array,
StringBuilder result)
|
protected void |
formatLongArray(long[] array,
StringBuilder result)
|
void |
formatMap(Map<?,?> map,
int currentDepth,
StringBuilder result)
Formats the given map. |
protected void |
formatObjectArray(Object[] array,
int currentDepth,
StringBuilder result)
|
protected void |
formatShortArray(short[] array,
StringBuilder result)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int maxNrOfElements
protected ObjectFormatter objectFormatter
Constructor Detail |
---|
public ArrayAndCollectionFormatter(int maxNrOfElements, ObjectFormatter objectFormatter)
maxNrOfElements
- The maximum nr of elements for arrays and collections to display > 0objectFormatter
- The object formatter that uses this array/collection formatter, not nullMethod Detail |
---|
public void formatArray(Object array, int currentDepth, StringBuilder result)
array
- The array, not nullcurrentDepth
- The current recursion depthresult
- The builder to append the result to, not nullpublic void formatCollection(Collection<?> collection, int currentDepth, StringBuilder result)
collection
- The collection, not nullcurrentDepth
- The current recursion depthresult
- The builder to append the result to, not nullpublic void formatMap(Map<?,?> map, int currentDepth, StringBuilder result)
map
- The map, not nullcurrentDepth
- The current recursion depthresult
- The builder to append the result to, not nullprotected void formatObjectArray(Object[] array, int currentDepth, StringBuilder result)
protected void formatByteArray(byte[] array, StringBuilder result)
protected void formatShortArray(short[] array, StringBuilder result)
protected void formatIntArray(int[] array, StringBuilder result)
protected void formatLongArray(long[] array, StringBuilder result)
protected void formatCharArray(char[] array, StringBuilder result)
protected void formatFloatArray(float[] array, StringBuilder result)
protected void formatDoubleArray(double[] array, StringBuilder result)
protected void formatBooleanArray(boolean[] array, StringBuilder result)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |