Class HashCodeAndEqualsPlugin.WithNonNullableFields
java.lang.Object
net.bytebuddy.build.HashCodeAndEqualsPlugin
net.bytebuddy.build.HashCodeAndEqualsPlugin.WithNonNullableFields
- All Implemented Interfaces:
Closeable, AutoCloseable, Plugin, Plugin.Factory, MethodAttributeAppender, MethodAttributeAppender.Factory, ElementMatcher<TypeDescription>
- Enclosing class:
HashCodeAndEqualsPlugin
@Enhance
public static class HashCodeAndEqualsPlugin.WithNonNullableFields
extends HashCodeAndEqualsPlugin
A version of the
HashCodeAndEqualsPlugin that assumes that all fields are non-nullable unless they are explicitly marked.-
Nested Class Summary
Nested classes/interfaces inherited from class HashCodeAndEqualsPlugin
HashCodeAndEqualsPlugin.AnnotationOrderComparator, HashCodeAndEqualsPlugin.Enhance, HashCodeAndEqualsPlugin.Identity, HashCodeAndEqualsPlugin.Sorted, HashCodeAndEqualsPlugin.ValueHandling, HashCodeAndEqualsPlugin.ValueMatcher, HashCodeAndEqualsPlugin.WithNonNullableFieldsNested classes/interfaces inherited from interface ElementMatcher
ElementMatcher.Junction<S>Nested classes/interfaces inherited from interface MethodAttributeAppender
MethodAttributeAppender.Compound, MethodAttributeAppender.Explicit, MethodAttributeAppender.Factory, MethodAttributeAppender.ForInstrumentedMethod, MethodAttributeAppender.ForReceiverType, MethodAttributeAppender.NoOpNested classes/interfaces inherited from interface MethodAttributeAppender.Factory
MethodAttributeAppender.Factory.CompoundNested classes/interfaces inherited from interface Plugin
Plugin.Engine, Plugin.Factory, Plugin.ForElementMatcher, Plugin.NoOp, Plugin.WithInitialization, Plugin.WithPreprocessorNested classes/interfaces inherited from interface Plugin.Factory
Plugin.Factory.Simple, Plugin.Factory.UsingReflection -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new hash code equals plugin where fields are assumed nullable by default.WithNonNullableFields(String annotationType) Creates a new hash code equals plugin where fields are assumed nullable by default. -
Method Summary
Modifier and TypeMethodDescriptionprotected ElementMatcher<FieldDescription> nonNullable(ElementMatcher<FieldDescription> matcher) Resolves the matcher to identify non-nullable fields.
-
Constructor Details
-
WithNonNullableFields
public WithNonNullableFields()Creates a new hash code equals plugin where fields are assumed nullable by default. -
WithNonNullableFields
Creates a new hash code equals plugin where fields are assumed nullable by default.- Parameters:
annotationType- Defines the binary name of a runtime-visible annotation type that should be added to the parameter of theObject.equals(Object)method, ornullif no such name should be defined.
-
-
Method Details
-
nonNullable
Resolves the matcher to identify non-nullable fields.- Overrides:
nonNullablein classHashCodeAndEqualsPlugin- Parameters:
matcher- The matcher that identifies fields that are either nullable or non-nullable.- Returns:
- The actual matcher to identify non-nullable fields.
-