Object#hashCode() that takes a class's declared fields into consideration. A hash code is computed by transforming
primitive field types to an int value and by summing those values up starting from a given offset after multiplying any previous value
with a multiplier. Reference values are checked against null values unless specified otherwise.
| Modifier and Type | Class and Description |
|---|---|
| protected static class | HashCodeMethod.Appender
A byte code appender to implement a hash code method. |
| protected static interface | HashCodeMethod.NullValueGuard
A guard against |
| protected static interface | HashCodeMethod.OffsetProvider
An offset provider is responsible for supplying the initial hash code. |
| protected static enum | HashCodeMethod.ValueTransformer
A value transformer that is responsible for resolving a field value to an |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | DEFAULT_MULTIPLIER
The default multiplier for each value before adding a field's hash code value which should be a prime number. |
| private static final int | DEFAULT_OFFSET
The default offset which should be a prime number. |
| private static final MethodDescription. | GET_CLASS
The |
| private static final MethodDescription. | HASH_CODE
The |
| private final ElementMatcher. | ignored
A matcher to filter fields that should not be used for a hash codes computation. |
| private final int | multiplier
A multiplier for each value before adding a field's hash code value. |
| private final ElementMatcher. | nonNullable
A matcher to determine fields of a reference type that cannot be |
| private final HashCodeMethod. | offsetProvider
The hash code's offset provider. |
| Access | Constructor and Description |
|---|---|
| protected | HashCodeMethod(HashCodeMethod.
The hash code's offset provider. offsetProviderCreates a new hash code method implementation. |
| private | HashCodeMethod(HashCodeMethod.
The hash code's offset provider. offsetProvider,A multiplier for each value before adding a field's hash code value multiplier, ElementMatcher.A matcher to filter fields that should not be used for a hash codes computation. ignored,A matcher to determine fields of a reference type that cannot be nonNullablenull.Creates a new hash code method implementation. |
| Modifier and Type | Method and Description |
|---|---|
| public ByteCodeAppender | appender(Implementation.
The target of the current implementation. implementationTargetImplements net. |
| public InstrumentedType | prepare(InstrumentedType
The instrumented type in its current form. instrumentedType)Implements net. |
| public static HashCodeMethod | Returns: A hash code method implementation that bases the hash code on a fixed value.Creates a hash code method implementation that bases the hash code on a fixed value. |
| public static HashCodeMethod | Returns: A hash code method implementation that bases the hash code on a fixed value.The fixed value. value)Creates a hash code method implementation that bases the hash code on a fixed value. |
| public static HashCodeMethod | Returns: A hash code method implementation that bases the hash code on the instrumented type's super class's hash code value.Creates a hash code method implementation that bases the hash code on the instrumented type's super class's hash code value. |
| public static HashCodeMethod | Returns: A hash code method implementation that bases the hash code on the instrumented type's class constant's hash code.true if the type should be resolved from the instance and not be set as the declaring class.Creates a hash code method implementation that bases the hash code on the instrumented type's class constant's hash code.. |
| public HashCodeMethod | Returns: A new version of this hash code method implementation that also ignores any fields matched by the provided matcher.A matcher to specify any fields that should be ignored. ignored)Returns a new version of this hash code method implementation that ignores the specified fields additionally to any previously specified fields. |
| public Implementation | Returns: A new version of this hash code method implementation that uses the given multiplier onto any given hash code before adding a field's hash code.The multiplier to use for any hash code before adding any field's hash code. multiplier)Returns a new version of this hash code method implementation that uses the given multiplier onto any given hash code before adding a field's hash code. |
| public HashCodeMethod | Returns: A new version of this hash code method implementation that also does not applynull value checks to any fields matched by
the provided matcher.A matcher to specify any fields that should not be guarded against nonNullable)null values.Returns a new version of this hash code method implementation that does not apply a |