Class Objects.ToStringHelper

java.lang.Object
org.eclipse.emf.compare.utils.Objects.ToStringHelper
Enclosing class:
Objects

public static class Objects.ToStringHelper
extends java.lang.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​(java.lang.Object target)
    Builds a toStringHelper for the given target object.
  • Method Summary

    Modifier and Type Method Description
    Objects.ToStringHelper add​(java.lang.String name, java.lang.Object value)
    Adds the given key/value pair that needs to appear in the final string representation.
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ToStringHelper

      public ToStringHelper​(java.lang.Object target)
      Builds a toStringHelper for the given target object.
      Parameters:
      target - Object for which we'll need a string representation.
  • Method Details

    • add

      public Objects.ToStringHelper add​(java.lang.String name, java.lang.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:
      this instance.
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object