@Beta
@GwtCompatible
public class ToStringHelper
extends java.lang.Object
Object.toString()
implementation
for value objects.Constructor and Description |
---|
ToStringHelper() |
Modifier and Type | Method and Description |
---|---|
protected void |
addField(java.lang.reflect.Field field,
java.lang.Object obj,
org.eclipse.xtext.xbase.lib.util.ToStringHelper.IndentationAwareStringBuilder sb)
Appends the fields and its value to the given string builder.
|
protected java.util.List<java.lang.reflect.Field> |
getAllDeclaredFields(java.lang.Class<?> clazz)
Computes a list of all declared fields of the given class and
its super classes.
|
protected void |
internalToString(java.lang.Object object,
org.eclipse.xtext.xbase.lib.util.ToStringHelper.IndentationAwareStringBuilder sb)
Append the field value
object the the given string builder. |
java.lang.String |
toString(java.lang.Object obj)
Creates a string representation of the given object by listing the internal
state of all fields.
|
public java.lang.String toString(java.lang.Object obj)
obj
- the object that should be printed.null
.protected void addField(java.lang.reflect.Field field, java.lang.Object obj, org.eclipse.xtext.xbase.lib.util.ToStringHelper.IndentationAwareStringBuilder sb)
field
- the field. May be a private field.obj
- the object that owns the field.sb
- the accumulating result.protected void internalToString(java.lang.Object object, org.eclipse.xtext.xbase.lib.util.ToStringHelper.IndentationAwareStringBuilder sb)
object
the the given string builder.object
- the value. May be null
.sb
- the accumulating result.protected java.util.List<java.lang.reflect.Field> getAllDeclaredFields(java.lang.Class<?> clazz)
clazz
- the clazz whose fields shall be collected.null
.