|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.xtext.xbase.lib.util.ToStringHelper
@Beta public class ToStringHelper
A helper class to assist construction of proper Object.toString()
implementation
for value objects.
Constructor Summary | |
---|---|
ToStringHelper()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ToStringHelper()
Method Detail |
---|
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
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |