Class CachedHashCodeInitializer<T>
- java.lang.Object
-
- nl.jqno.equalsverifier.internal.util.CachedHashCodeInitializer<T>
-
public class CachedHashCodeInitializer<T> extends java.lang.Object
Records an initializer for a cached hash code (field name and recompute method), if any, for the object to be verified. EqualsVerifier may then, instead of callingObject.hashCode()
to obtain the hash code, call thegetInitializedHashCode(Object)
method in this class: * If this class has recorded a cached hash code initializer for the object, that method will recompute and update the cached hash code in the object automatically, before returning the result ofObject.hashCode()
. * If this class has not recorded a cached hash code initializer for the object, it will simply return the value ofObject.hashCode()
as normal instead.
-
-
Constructor Summary
Constructors Constructor Description CachedHashCodeInitializer(java.lang.Class<?> type, java.lang.String cachedHashCodeField, java.lang.String calculateHashCodeMethod, T example)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getCachedHashCodeFieldName()
T
getExample()
int
getInitializedHashCode(java.lang.Object object)
boolean
isPassthrough()
static <T> CachedHashCodeInitializer<T>
passthrough()
-
-
-
Constructor Detail
-
CachedHashCodeInitializer
public CachedHashCodeInitializer(java.lang.Class<?> type, java.lang.String cachedHashCodeField, java.lang.String calculateHashCodeMethod, T example)
-
-
Method Detail
-
passthrough
public static <T> CachedHashCodeInitializer<T> passthrough()
-
isPassthrough
public boolean isPassthrough()
-
getExample
public T getExample()
-
getCachedHashCodeFieldName
public java.lang.String getCachedHashCodeFieldName()
-
getInitializedHashCode
public int getInitializedHashCode(java.lang.Object object)
-
-