|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectorg.test4j.hamcrest.matcher.property.report.ObjectFormatter
public class ObjectFormatter
A class for generating a string representation of any object, array or primitive value.
Non-primitive objects are processed recursively so that a string representation of inner objects is also generated. Too avoid too much output, this recursion is limited with a given maximum depth.
| 字段摘要 | |
|---|---|
protected int |
maxDepth
The maximum recursion depth |
| 构造方法摘要 | |
|---|---|
ObjectFormatter()
Creates a formatter with a maximum recursion depth of 5. |
|
ObjectFormatter(int maxDepth)
Creates a formatter with the given maximum recursion depth. |
|
| 方法摘要 | |
|---|---|
String |
format(Object object)
Gets the string representation of the given object. |
protected void |
formatArray(Object array,
int currentDepth,
StringBuilder result)
Formats the given array. |
protected void |
formatCollection(Collection<?> collection,
int currentDepth,
StringBuilder result)
Formats the given collection. |
protected void |
formatFields(Object object,
Class clazz,
int currentDepth,
StringBuilder result)
Formats the field values of the given object. |
protected void |
formatImpl(Object object,
int currentDepth,
StringBuilder result)
Actual implementation of the formatting. |
protected void |
formatMap(Map<?,?> map,
int currentDepth,
StringBuilder result)
Formats the given map. |
protected void |
formatObject(Object object,
int currentDepth,
StringBuilder result)
Formats the given object by formatting the inner fields. |
protected boolean |
formatProxy(Object object,
StringBuilder result)
|
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
protected int maxDepth
| 构造方法详细信息 |
|---|
public ObjectFormatter()
public ObjectFormatter(int maxDepth)
maxDepth - The max depth > 0| 方法详细信息 |
|---|
public String format(Object object)
object - The instance
protected void formatImpl(Object object,
int currentDepth,
StringBuilder result)
object - The instancecurrentDepth - The current recursion depthresult - The builder to append the result to, not null
protected 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 null
protected 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 null
protected 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 null
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 null
protected 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 null
protected boolean formatProxy(Object object,
StringBuilder result)
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||