public class ObjectFormatter extends Object
| Modifier and Type | Field and Description |
|---|---|
protected ArrayAndCollectionFormatter |
arrayAndCollectionFormatter |
protected int |
maxDepth |
protected int |
maxNrArrayOrCollectionElements |
static String |
MOCK_NAME_CHAIN_SEPARATOR |
| Constructor and Description |
|---|
ObjectFormatter()
Creates a formatter with a maximum recursion depth of 3.
|
ObjectFormatter(int maxDepth,
int maxNrArrayOrCollectionElements)
Creates a formatter with the given maximum recursion depth.
|
| Modifier and Type | Method and Description |
|---|---|
String |
format(Object object)
Gets the string representation of the given object.
|
protected boolean |
formatCharacter(Object object,
Class<?> type,
StringBuilder result) |
protected void |
formatFields(Object object,
Class<?> clazz,
int currentDepth,
StringBuilder result)
Formats the field values of the given object.
|
protected boolean |
formatFile(Object object,
StringBuilder result) |
protected void |
formatImpl(Object object,
int currentDepth,
StringBuilder result)
Actual implementation of the formatting.
|
protected boolean |
formatJavaLang(Object object,
StringBuilder result,
Class<?> type) |
protected boolean |
formatMock(Object object,
StringBuilder result) |
protected boolean |
formatNumberOrDate(Object object,
StringBuilder result) |
protected void |
formatObject(Object object,
int currentDepth,
StringBuilder result)
Formats the given object by formatting the inner fields.
|
protected boolean |
formatPrimitiveOrEnum(Object object,
Class<?> type,
StringBuilder result) |
protected boolean |
formatProxy(Object object,
Class<?> type,
StringBuilder result) |
protected boolean |
formatString(Object object,
StringBuilder result) |
protected Class<?> |
getDummyObjectClass() |
protected Class<?> |
getProxyUtilsClass() |
protected boolean |
isDummy(Object object) |
public static final String MOCK_NAME_CHAIN_SEPARATOR
protected int maxDepth
protected int maxNrArrayOrCollectionElements
protected ArrayAndCollectionFormatter arrayAndCollectionFormatter
public ObjectFormatter()
public ObjectFormatter(int maxDepth,
int maxNrArrayOrCollectionElements)
maxDepth - The max depth > 0maxNrArrayOrCollectionElements - The maximum nr of elements for arrays and collections to display > 0public String format(Object object)
object - The instanceprotected void formatImpl(Object object, int currentDepth, StringBuilder result)
object - The instancecurrentDepth - The current recursion depthresult - The builder to append the result to, not nullprotected boolean formatJavaLang(Object object, StringBuilder result, Class<?> type)
protected boolean formatPrimitiveOrEnum(Object object, Class<?> type, StringBuilder result)
protected boolean formatCharacter(Object object, Class<?> type, StringBuilder result)
protected boolean formatNumberOrDate(Object object, StringBuilder result)
protected boolean formatString(Object object, StringBuilder result)
protected void formatObject(Object object, int currentDepth, StringBuilder result)
object - The object, not nullcurrentDepth - The current recursion depthresult - The builder to append the result to, not nullprotected void formatFields(Object object, Class<?> clazz, int currentDepth, StringBuilder result)
object - The object, not nullclazz - The class for which to format the fields, not nullcurrentDepth - The current recursion depthresult - The builder to append the result to, not nullprotected boolean formatMock(Object object, StringBuilder result)
protected boolean isDummy(Object object)
protected boolean formatProxy(Object object, Class<?> type, StringBuilder result)
protected boolean formatFile(Object object, StringBuilder result)
protected Class<?> getDummyObjectClass()
protected Class<?> getProxyUtilsClass()
Copyright © 2016. All Rights Reserved.