Package com.io7m.jequality.validator
Class EqualityValidator
java.lang.Object
com.io7m.jequality.validator.EqualityValidator
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).
-
Method Summary
Modifier and TypeMethodDescriptionstatic ValidatorResultvalidateClass(Class<?> c, AnnotationRequirement requirement, boolean check_hashcode) Validate the given class according to the annotation requirements.
-
Method Details
-
validateClass
public static ValidatorResult validateClass(Class<?> c, AnnotationRequirement requirement, boolean check_hashcode) Validate the given class according to the annotation requirements.- Parameters:
c- The classrequirement- The annotation requirementscheck_hashcode-trueifhashCodemethods should be checked for consistency- Returns:
trueif the class is valid according to its annotations
-