Package org.eclipse.emf.compare.utils
Class Objects.ToStringHelper
- java.lang.Object
-
- org.eclipse.emf.compare.utils.Objects.ToStringHelper
-
- Enclosing class:
- Objects
public static class Objects.ToStringHelper extends Object
Fluent interface to build a String representation of an object following the same format as guava's Objects.toStringHelper().Resulting toString() will look like <className>{attribute=value, attribute1=value1} according to the number of attributes that have been
added.
-
-
Constructor Summary
Constructors Constructor Description ToStringHelper(Object target)Builds a toStringHelper for the given target object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objects.ToStringHelperadd(String name, Object value)Adds the given key/value pair that needs to appear in the final string representation.StringtoString()
-
-
-
Constructor Detail
-
ToStringHelper
public ToStringHelper(Object target)
Builds a toStringHelper for the given target object.- Parameters:
target- Object for which we'll need a string representation.
-
-
Method Detail
-
add
public Objects.ToStringHelper add(String name, Object value)
Adds the given key/value pair that needs to appear in the final string representation.Key/value pairs will appear in the final representation in the same order they have been added through here.
- Parameters:
name- Name of the pair.value- Value of the pair.- Returns:
thisinstance.
-
-