Module nl.jqno.equalsverifier
Class CachedHashCodeInitializer<T>
java.lang.Object
nl.jqno.equalsverifier.internal.util.CachedHashCodeInitializer<T>
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 calling Object.hashCode() to obtain the hash code, call the
getInitializedHashCode(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 of Object.hashCode().
* If this class has not recorded a cached hash code initializer for the object, it will simply return the value of
Object.hashCode() as normal instead.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FieldProbeprivate final Methodprivate final Tprivate final boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateprivateCachedHashCodeInitializer(boolean passthrough, FieldProbe cachedHashCodeField, Method calculateMethod, T example) CachedHashCodeInitializer(Class<?> type, String cachedHashCodeField, String calculateHashCodeMethod, T example) -
Method Summary
Modifier and TypeMethodDescriptionprivate static FieldProbefindCachedHashCodeField(Class<?> type, String cachedHashCodeFieldName) private static MethodfindCalculateHashCodeMethod(Class<?> type, String calculateHashCodeMethodName, boolean acceptPublicMethod) intgetInitializedHashCode(Object object) booleanstatic <T> CachedHashCodeInitializer<T> lombokCachedHashcode(T example) static <T> CachedHashCodeInitializer<T> private voidrecomputeCachedHashCode(Object object)
-
Field Details
-
passthrough
private final boolean passthrough -
cachedHashCodeField
-
calculateMethod
-
example
-
-
Constructor Details
-
CachedHashCodeInitializer
private CachedHashCodeInitializer() -
CachedHashCodeInitializer
private CachedHashCodeInitializer(boolean passthrough, FieldProbe cachedHashCodeField, Method calculateMethod, T example) -
CachedHashCodeInitializer
-
-
Method Details
-
passthrough
-
lombokCachedHashcode
-
isPassthrough
public boolean isPassthrough() -
getExample
-
getCachedHashCodeFieldName
-
getInitializedHashCode
-
recomputeCachedHashCode
-
findCachedHashCodeField
-
findCalculateHashCodeMethod
-