@HashCodeAndEqualsPlugin.Enhance public class HashCodeAndEqualsPlugin extends Object implements Plugin
Object.hashCode() and Object.equals(Object) methods to a class if the
HashCodeAndEqualsPlugin.Enhance annotation is present and no explicit method declaration was added.| Modifier and Type | Class and Description |
|---|---|
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. |
static interface |
HashCodeAndEqualsPlugin.ValueHandling
Determines how a field should be used within generated hash code and equality methods.
|
protected static class |
HashCodeAndEqualsPlugin.ValueMatcher
An element matcher for a
HashCodeAndEqualsPlugin.ValueHandling annotation. |
static class |
HashCodeAndEqualsPlugin.WithNonNullableFields
A version of the
HashCodeAndEqualsPlugin that assumes that all fields are non-nullable unless they are explicitly marked. |
Plugin.Compound, Plugin.ForElementMatcher, Plugin.NoOpElementMatcher.Junction<S>| Constructor and Description |
|---|
HashCodeAndEqualsPlugin() |
| Modifier and Type | Method and Description |
|---|---|
DynamicType.Builder<?> |
apply(DynamicType.Builder<?> builder,
TypeDescription typeDescription,
ClassFileLocator classFileLocator)
Applies this plugin.
|
boolean |
matches(TypeDescription target)
Matches a target against this element matcher.
|
protected ElementMatcher<FieldDescription> |
nonNullable(ElementMatcher<FieldDescription> matcher)
Resolves the matcher to identify non-nullable fields.
|
public boolean matches(TypeDescription target)
ElementMatchermatches in interface ElementMatcher<TypeDescription>target - The instance to be matched.true if the given element is matched by this matcher or false otherwise.public DynamicType.Builder<?> apply(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassFileLocator classFileLocator)
Pluginapply in interface Pluginbuilder - The builder to use as a basis for the applied transformation.typeDescription - The type being transformed.classFileLocator - A class file locator that can locate other types in the scope of the project.protected ElementMatcher<FieldDescription> nonNullable(ElementMatcher<FieldDescription> matcher)
matcher - The matcher that identifies fields that are either nullable or non-nullable.Copyright © 2014–2018. All rights reserved.