Package net.bytebuddy.build
Annotation Interface HashCodeAndEqualsPlugin.Enhance
- Enclosing class:
- HashCodeAndEqualsPlugin
@Documented
@Target(TYPE)
@Retention(RUNTIME)
public static @interface HashCodeAndEqualsPlugin.Enhance
Instructs the
HashCodeAndEqualsPlugin
to generate Object.hashCode()
and Object.equals(Object)
for the annotated
class unless these methods are already declared explicitly.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
A strategy for determining the base value of a hash code or equality contract. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionboolean
Determines if synthetic fields should be included in the hash code and equality contract.Determines the base value of any added method, i.e.boolean
Determines if instances subclasses of the instrumented type are accepted upon an equality check.boolean
Determines if fields with primitive types, then enumeration types, then primtive wrapper types and thenString
types should be compared for equality before fields with other types.boolean
Determines if the hash code constant should be derived of the instrumented type.
-
Element Details
-
invokeSuper
HashCodeAndEqualsPlugin.Enhance.InvokeSuper invokeSuperDetermines the base value of any added method, i.e. if hash code or equality is based on the super type or not.- Returns:
- A strategy for determining the base value.
- Default:
- IF_DECLARED
-
simpleComparisonsFirst
boolean simpleComparisonsFirstDetermines if fields with primitive types, then enumeration types, then primtive wrapper types and thenString
types should be compared for equality before fields with other types. Before determining such a field order, theHashCodeAndEqualsPlugin.Sorted
property is always considered first if it is defined.- Returns:
true
if fields with simple comparison methods should be compared first.
- Default:
- true
-
includeSyntheticFields
boolean includeSyntheticFieldsDetermines if synthetic fields should be included in the hash code and equality contract.- Returns:
true
if synthetic fields should be included.
- Default:
- false
-
permitSubclassEquality
boolean permitSubclassEqualityDetermines if instances subclasses of the instrumented type are accepted upon an equality check.- Returns:
true
if instances subclasses of the instrumented type are accepted upon an equality check.
- Default:
- false
-
useTypeHashConstant
boolean useTypeHashConstantDetermines if the hash code constant should be derived of the instrumented type. IfpermitSubclassEquality()
is set totrue
, this constant is derived of the declared class, otherwise the type hash is computed of the active instance.- Returns:
true
if the hash code constant should be derived of the instrumented type.
- Default:
- true
-