@Target(value=TYPE)
@Retention(value=SOURCE)
public @interface EqualsAndHashCode
equals
and hashCode
methods inherited by all objects, based on relevant fields.
Complete documentation is found at the project lombok features page for @EqualsAndHashCode.
Modifier and Type | Optional Element and Description |
---|---|
boolean |
callSuper
Call on the superclass's implementations of
equals and hashCode before calculating for the fields in this class. |
boolean |
doNotUseGetters
Normally, if getters are available, those are called.
|
java.lang.String[] |
exclude
Any fields listed here will not be taken into account in the generated
equals and hashCode implementations. |
java.lang.String[] |
of
If present, explicitly lists the fields that are to be used for identity.
|
EqualsAndHashCode.AnyAnnotation[] |
onParam
Any annotations listed here are put on the generated parameter of
equals and canEqual . |
public abstract java.lang.String[] exclude
equals
and hashCode
implementations.
Mutually exclusive with of()
.public abstract java.lang.String[] of
Mutually exclusive with exclude()
.
public abstract boolean callSuper
equals
and hashCode
before calculating for the fields in this class.
default: falseequals
implementation as part of the generated equals algorithm.public abstract boolean doNotUseGetters
true
.
default: falsetrue
, always use direct field access instead of calling the getter method.public abstract EqualsAndHashCode.AnyAnnotation[] onParam
equals
and canEqual
.
This is useful to add for example a Nullable
annotation.@EqualsAndHashCode(onParam=@__({@AnnotationsGoHere}))
@EqualsAndHashCode(onParam_={@AnnotationsGohere})
// note the underscore after onParam
.equals()
method.Copyright © 2009-2015 The Project Lombok Authors, licensed under the MIT licence.