Package net.bytebuddy.build
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 net.bytebuddy.build.HashCodeAndEqualsPlugin
HashCodeAndEqualsPlugin.AnnotationOrderComparator, HashCodeAndEqualsPlugin.Enhance, HashCodeAndEqualsPlugin.Sorted, HashCodeAndEqualsPlugin.ValueHandling, HashCodeAndEqualsPlugin.ValueMatcher, HashCodeAndEqualsPlugin.WithNonNullableFields
Nested classes/interfaces inherited from interface net.bytebuddy.matcher.ElementMatcher
ElementMatcher.Junction<S>
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.attribute.MethodAttributeAppender
MethodAttributeAppender.Compound, MethodAttributeAppender.Explicit, MethodAttributeAppender.Factory, MethodAttributeAppender.ForInstrumentedMethod, MethodAttributeAppender.ForReceiverType, MethodAttributeAppender.NoOp
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.attribute.MethodAttributeAppender.Factory
MethodAttributeAppender.Factory.Compound
Nested classes/interfaces inherited from interface net.bytebuddy.build.Plugin
Plugin.Engine, Plugin.Factory, Plugin.ForElementMatcher, Plugin.NoOp, Plugin.WithInitialization, Plugin.WithPreprocessor
Nested classes/interfaces inherited from interface net.bytebuddy.build.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, ornull
if no such name should be defined.
-
-
Method Details
-
nonNullable
Resolves the matcher to identify non-nullable fields.- Overrides:
nonNullable
in classHashCodeAndEqualsPlugin
- Parameters:
matcher
- The matcher that identifies fields that are either nullable or non-nullable.- Returns:
- The actual matcher to identify non-nullable fields.
-