public final class EqualityValidator extends Object
A validator that examines a class and tries to determine whether the class uses reference equality or structural equality.
A class is
assumed to use reference equality if neither it nor any of its supertypes
overrides the equals method provided by Object.
A
class is assumed to use structural equality if it overrides the
equals method provided by Object.
The equals method
of a class is assumed to be consistent with the hashCode
method if they are both defined in the same class. Checking for true
consistency is obviously undecidable.
A class is valid if it
uses the correct type of equality relative to its annotations (EqualityReference, EqualityStructural).
| Modifier and Type | Method | Description |
|---|---|---|
static ValidatorResult |
validateClass(Class<?> c,
AnnotationRequirement requirement,
boolean check_hashcode) |
Validate the given class according to the annotation requirements.
|
public static ValidatorResult validateClass(Class<?> c, AnnotationRequirement requirement, boolean check_hashcode)
c - The classrequirement - The annotation requirementscheck_hashcode - true if hashCode methods should be
checked for consistencytrue if the class is valid according to its annotationsCopyright © 2017 <code@io7m.com> http://io7m.com