public final class EqualsHashCodeAndToStringEvaluator extends Object
EqualsHashCodeAndToStringEvaluator is a combination of all evaluators.| Constructor and Description |
|---|
EqualsHashCodeAndToStringEvaluator() |
| Modifier and Type | Method and Description |
|---|---|
static <T> boolean |
evaluateEqualsAndHashcode(T first,
T second,
T third,
T fourth)
Evaluates the all the contract conditions for the methods
Object.equals(Object) and
Object.hashCode(). |
static <T> boolean |
evaluateEqualsAndHashcodeEquality(T object,
T otherObject)
Evaluates the contract conditions for reflexivity, non null, symmetric and consistency of the
given objects, that means according to
Object.equals(Object) that this method should
evaluate the following contract condition:
It is reflexive: for any non-null reference value x, x.equals(x)
should return true. |
static <T> boolean |
evaluateEqualsAndHashcodeUnequality(T object,
T otherObject)
Evaluates the contract conditions for reflexivity, non null, symmetric and consistency of the
given objects, that means according to
Object.equals(Object) that this method should
evaluate the following contract condition:
It is reflexive: for any non-null reference value x, x.equals(x)
should return true. |
static <T> boolean |
evaluateEqualsHashcodeAndToString(Class<T> cls)
Evaluates all the contract conditions for the methods
Object.equals(Object),
Object.hashCode() and Object.toString() from the given Class. |
static <T> boolean |
evaluateEqualsHashcodeAndToString(Class<T> cls,
Function<Class<T>,T> function)
Evaluates all the contract conditions for the methods
Object.equals(Object),
Object.hashCode() and Object.toString() from the given Class. |
static <T> boolean |
evaluateEqualsHashcodeAndToString(T object)
Deprecated.
use instead the
EqualsEvaluator.evaluateReflexivityAndNonNull method
in combination with the HashcodeEvaluator.evaluateConsistency and
the ToStringEvaluator.evaluateConsistency method. Note: will be removed in the next minor version |
static <T> boolean |
evaluateEqualsHashcodeAndToString(T first,
T second,
T third,
T fourth)
Evaluates the all the contract conditions for the methods
Object.equals(Object),
Object.hashCode() and Object.toString(). |
static <T> boolean |
evaluateEqualsHashcodeEqualityAndToString(T object,
T otherObject,
T anotherObject)
Deprecated.
use instead the
evaluateEqualsHashcodeAndToString method Note: will be removed in the next minor version |
public static <T> boolean evaluateEqualsAndHashcode(T first,
T second,
T third,
T fourth)
Object.equals(Object) and
Object.hashCode().T - the generic typefirst - the first objectsecond - the second object that have to be uneqal to the first objectthird - the third object have to be equal to first object and fourth objectfourth - the fourth object have to be equal to first object and third objectObject.equals(Object) and
Object.hashCode() is given otherwise falsepublic static <T> boolean evaluateEqualsAndHashcodeEquality(T object,
T otherObject)
Object.equals(Object) that this method should
evaluate the following contract condition:
x, x.equals(x)
should return true.
x, x.equals(null) should return
false.
x and y,
x.equals(y) should return true if and only if y.equals(x) returns
true.
x and y,
multiple invocations of x.equals(y) consistently return true or consistently
return false, provided no information used in equals comparisons on the
objects is modified.
Object.equals(Object)
Evaluate equality of hash code from the given objects that should be equal(if not an
IllegalArgumentException will be thrown), that means according to
Object.hashCode() that this method should evaluate the following contract condition:
equals(Object) method, then calling the
hashCode method on each of the two objects must produce the same integer result.
T - the generic typeobject - the objectotherObject - the other objectpublic static <T> boolean evaluateEqualsAndHashcodeUnequality(T object,
T otherObject)
Object.equals(Object) that this method should
evaluate the following contract condition:
x, x.equals(x)
should return true.
x, x.equals(null) should return
false.
x and y,
x.equals(y) should return true if and only if y.equals(x) returns
true.
x and y,
multiple invocations of x.equals(y) consistently return true or consistently
return false, provided no information used in equals comparisons on the
objects is modified.
Object.equals(Object)
Evaluate unequality of hash code from the given objects that should be unequal(if not an
IllegalArgumentException will be thrown), that means according to
Object.hashCode() that this method should evaluate the following contract condition:
Object.equals(java.lang.Object) method, then calling the hashCode
method on each of the two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results for unequal objects may
improve the performance of hash tables.
T - the generic typeobject - the objectotherObject - the other objectpublic static <T> boolean evaluateEqualsHashcodeAndToString(Class<T> cls) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, IOException
Object.equals(Object),
Object.hashCode() and Object.toString() from the given Class.T - the generic typecls - the classObject.equals(Object),
Object.hashCode() and Object.toString() is given otherwise falseIllegalAccessException - if the caller does not have access to the property accessor methodInstantiationException - if a new instance of the bean's class cannot be instantiatedInvocationTargetException - if the property accessor method throws an exceptionNoSuchMethodException - if an accessor method for this property cannot be foundIOException - Signals that an I/O exception has occurred.public static <T> boolean evaluateEqualsHashcodeAndToString(Class<T> cls, Function<Class<T>,T> function) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, IOException
Object.equals(Object),
Object.hashCode() and Object.toString() from the given Class.T - the generic typecls - the classfunction - the function that can create random objectsObject.equals(Object),
Object.hashCode() and Object.toString() is given otherwise falseNoSuchMethodException - if an accessor method for this property cannot be foundIllegalAccessException - if the caller does not have access to the property accessor methodInvocationTargetException - if the property accessor method throws an exceptionInstantiationException - if a new instance of the bean's class cannot be instantiatedIOException - Signals that an I/O exception has occurred.@Deprecated public static <T> boolean evaluateEqualsHashcodeAndToString(T object)
EqualsEvaluator.evaluateReflexivityAndNonNull method
in combination with the HashcodeEvaluator.evaluateConsistency and
the ToStringEvaluator.evaluateConsistency method. Object.equals(Object) that this method should evaluate the following contract
condition:
x, x.equals(x)
should return true.
x, x.equals(null) should return
false.
Object.equals(Object)
Evaluate consistency of the given object, that means according to Object.hashCode()
that this method should evaluate the following contract condition:
hashCode method must consistently return the same integer, provided
no information used in equals comparisons on the object is modified. This integer
need not remain consistent from one execution of an application to another execution of the
same application.
Object.hashCode()T - the generic typeobject - the objectObject.equals(Object) and the consistency contract condition of
Object.hashCode() is given otherwise falsepublic static <T> boolean evaluateEqualsHashcodeAndToString(T first,
T second,
T third,
T fourth)
Object.equals(Object),
Object.hashCode() and Object.toString().T - the generic typefirst - the first objectsecond - the second object that have to be uneqal to the first objectthird - the third object have to be equal to first object and fourth objectfourth - the fourth object have to be equal to first object and third objectObject.equals(Object),
Object.hashCode() and Object.toString() is given otherwise false@Deprecated public static <T> boolean evaluateEqualsHashcodeEqualityAndToString(T object, T otherObject, T anotherObject)
evaluateEqualsHashcodeAndToString method Object.toString() for the given objects Object.hashCode()
that this method should evaluate the following contract condition:
hashCode method must consistently return the same integer, provided
no information used in equals comparisons on the object is modified. This integer
need not remain consistent from one execution of an application to another execution of the
same application.
Object.hashCode()
Evaluate equality of hash code from the given objects that should be equal(if not an
IllegalArgumentException will be thrown), that means according to
Object.hashCode() that this method should evaluate the following contract condition:
equals(Object) method, then calling the
hashCode method on each of the two objects must produce the same integer result.
Object.equals(Object) that
this method should evaluate the following contract condition:
x, x.equals(x)
should return true.
x, x.equals(null) should return
false.
x and y,
x.equals(y) should return true if and only if y.equals(x) returns
true.
x and y,
multiple invocations of x.equals(y) consistently return true or consistently
return false, provided no information used in equals comparisons on the
objects is modified.
x, y, and
z, if x.equals(y) returns true and y.equals(z) returns
true, then x.equals(z) should return true.
Object.equals(Object)T - the generic typeobject - the objectotherObject - the other objectanotherObject - the another objectObject.toString() for the given objects and if
consistency contract condition of Object.hashCode() is given and if equality
of hash code from the given objects is given and if reflexivity, non null, symmetric,
consistency and transitivity contract conditions is given otherwise falseCopyright © 2015–2018 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.