Class ElementSelector

java.lang.Object
de.danielbechler.diff.selector.ElementSelector
Direct Known Subclasses:
BeanPropertyElementSelector, CollectionItemElementSelector, MapKeyElementSelector, RootElementSelector

public abstract class ElementSelector extends Object
Serves mainly as marker class and enforces the proper implementation of hashCode(), equals() and toString() for all element selectors.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract boolean
    Must be implemented in a way so that this element can be distinguished from the other ones.
    abstract int
    Make sure to implement this properly.
    abstract String
     
    final String
    The string representation will only be used to print readable property paths for debug purposes.

    Methods inherited from class java.lang.Object

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

    • ElementSelector

      public ElementSelector()
  • Method Details

    • toHumanReadableString

      public abstract String toHumanReadableString()
    • equals

      public abstract boolean equals(Object obj)
      Must be implemented in a way so that this element can be distinguished from the other ones.
      Overrides:
      equals in class Object
      Parameters:
      obj - The object to check equality against.
      Returns:
      true is the given object equals this one, otherwise false.
    • hashCode

      public abstract int hashCode()
      Make sure to implement this properly. If two elements are equal, their hash code must be equal as well. However, it is absolutely okay if two unequal elements return the same hash code. A simple implementation could just return 0.
      Overrides:
      hashCode in class Object
      Returns:
      The hash code of this element.
    • toString

      public final String toString()
      The string representation will only be used to print readable property paths for debug purposes.
      Overrides:
      toString in class Object
      Returns:
      A string representation of this element for debug purposes.