de.danielbechler.diff.path
Class Element

java.lang.Object
  extended by de.danielbechler.diff.path.Element
Direct Known Subclasses:
CollectionElement, MapElement, NamedPropertyElement, RootElement

public abstract class Element
extends Object

Serves mainly as marker class and enforces the proper implementation of hashCode(), equals() and toString() for all property path elements.

Author:
Daniel Bechler

Constructor Summary
Element()
           
 
Method Summary
abstract  boolean equals(Object obj)
          Must be implemented in a way so that this element can be distinguished from the other ones.
abstract  int hashCode()
          Make sure to implement this properly.
abstract  String toString()
          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 Detail

Element

public Element()
Method Detail

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 abstract 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.


Copyright © 2012. All Rights Reserved.