@HashCodeAndEqualsPlugin.Enhance public class HashCodeMethod extends Object implements Implementation
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.AppenderA byte code appender to implement a hash code method. | 
| protected static interface  | HashCodeMethod.NullValueGuardA guard against  nullvalues for fields with reference types. | 
| protected static interface  | HashCodeMethod.OffsetProviderAn offset provider is responsible for supplying the initial hash code. | 
| protected static class  | HashCodeMethod.ValueTransformerA value transformer that is responsible for resolving a field value to an  intvalue. | 
Implementation.Composable, Implementation.Compound, Implementation.Context, Implementation.Simple, Implementation.SpecialMethodInvocation, Implementation.Target| Modifier | Constructor and Description | 
|---|---|
| protected  | HashCodeMethod(HashCodeMethod.OffsetProvider offsetProvider)Creates a new hash code method implementation. | 
| Modifier and Type | Method and Description | 
|---|---|
| ByteCodeAppender | appender(Implementation.Target implementationTarget)Creates a byte code appender that determines the implementation of the instrumented type's methods. | 
| InstrumentedType | prepare(InstrumentedType instrumentedType)Prepares a given instrumented type. | 
| static HashCodeMethod | usingDefaultOffset()Creates a hash code method implementation that bases the hash code on a fixed value. | 
| static HashCodeMethod | usingOffset(int value)Creates a hash code method implementation that bases the hash code on a fixed value. | 
| static HashCodeMethod | usingSuperClassOffset()Creates a hash code method implementation that bases the hash code on the instrumented type's super class's hash code value. | 
| HashCodeMethod | withIgnoredFields(ElementMatcher<? super FieldDescription.InDefinedShape> ignored)Returns a new version of this hash code method implementation that ignores the specified fields additionally to any
 previously specified fields. | 
| Implementation | withMultiplier(int 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. | 
| HashCodeMethod | withNonNullableFields(ElementMatcher<? super FieldDescription.InDefinedShape> nonNullable)Returns a new version of this hash code method implementation that does not apply a  nullvalue check for the specified fields
 if they have a reference type additionally to any previously specified fields. | 
protected HashCodeMethod(HashCodeMethod.OffsetProvider offsetProvider)
offsetProvider - The hash code's offset provider.public static HashCodeMethod usingSuperClassOffset()
public static HashCodeMethod usingDefaultOffset()
public static HashCodeMethod usingOffset(int value)
value - The fixed value.public HashCodeMethod withIgnoredFields(ElementMatcher<? super FieldDescription.InDefinedShape> ignored)
ignored - A matcher to specify any fields that should be ignored.public HashCodeMethod withNonNullableFields(ElementMatcher<? super FieldDescription.InDefinedShape> nonNullable)
null value check for the specified fields
 if they have a reference type additionally to any previously specified fields.nonNullable - A matcher to specify any fields that should not be guarded against null values.null value checks to any fields matched by
 the provided matcher.public Implementation withMultiplier(int multiplier)
multiplier - The multiplier to use for any hash code before adding any field's hash code.public InstrumentedType prepare(InstrumentedType instrumentedType)
prepare in interface InstrumentedType.PrepareableinstrumentedType - The instrumented type in its current form.public ByteCodeAppender appender(Implementation.Target implementationTarget)
appender in interface ImplementationimplementationTarget - The target of the current implementation.InstrumentedType.Prepareable.prepare(InstrumentedType).Copyright © 2014–2019. All rights reserved.