Class HashCode

java.lang.Object
de.espirit.common.util.HashCode
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DefaultGomLangInfo.GomLangHashCode

@NonExtendable public abstract class HashCode extends Object implements Serializable

Abstract HashCode container to ease maintaining a hashCode for complex classes having mutable values being part of the hashCode. HashCode gets computed based on the description given in "Effective Java".

To compute the hashCode, subclasses have to override append(), which may append all fields important for equality by invoking the protected append-methods.

This implementation will cache a computed hashCode until it is marked with beDirty().

This class is heavyweight, use HashCodeBuilder as a lightweight option.

Since:
4.0.120
See Also:
  • Constructor Details

    • HashCode

      public HashCode()
  • Method Details

    • toHashCode

      public int toHashCode()
      Get the computed hashCode.
      Returns:
      The computed hashCode.
      Since:
      4.0.20