public final class EqualsCheck extends Object
EqualsCheck provides algorithms for check the equals
contract of an given object.| Constructor and Description |
|---|
EqualsCheck() |
| Modifier and Type | Method and Description |
|---|---|
static <T> Optional<ContractViolation> |
consistency(T object,
T anotherObject)
Checks the contract condition for consistency of the given objects, that means according to
Object.equals(Object) that this method should evaluate the following contract
condition:
It is consistent: for any non-null reference values 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. |
static <T> Optional<ContractViolation> |
consistency(T object,
T anotherObject,
int iterations)
Checks the contract condition for consistency of the given objects, that means according to
Object.equals(Object) that this method should evaluate the following contract
condition:
It is consistent: for any non-null reference values 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. |
static <T> Optional<ContractViolation> |
nonNull(T object)
Checks the contract condition for non-null condition is given of the given object, that means
according to
Object.equals(Object) that this method should evaluate the following
contract condition:
For any non-null reference value x, x.equals(null) should return
false. |
static <T> Optional<ContractViolation> |
reflexivity(T object)
Checks the contract condition for reflexivity of the given object, 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> Optional<ContractViolation> |
reflexivityAndNonNull(T object)
Checks the contract conditions for reflexivity and non null, 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> Optional<ContractViolation> |
reflexivityNonNullSymmetricAndConsistency(T object,
T otherObject)
Checks 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> Optional<ContractViolation> |
reflexivityNonNullSymmetricConsistencyAndTransitivity(T object,
T otherObject,
T anotherObject)
Checks the contract conditions for reflexivity, non null, symmetric, consistency and
transitivity 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> Optional<ContractViolation> |
symmetric(T object,
T anotherObject)
Checks the contract condition for symmetric of the given objects, that means according to
Object.equals(Object) that this method should evaluate the following contract
condition:
It is symmetric: for any non-null reference values x and y,
x.equals(y) should return true if and only if y.equals(x) returns
true. |
static <T> Optional<ContractViolation> |
symmetricAndConsistency(T object,
T anotherObject)
Checks the contract conditions for 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 symmetric: for any non-null reference values x and y,
x.equals(y) should return true if and only if y.equals(x) returns
true. |
static <T> Optional<ContractViolation> |
transitivity(T a,
T b,
T c)
Checks the contract condition for transitivity of the given objects, that means according to
Object.equals(Object) that this method should evaluate the following contract
condition:
It is transitive: for any non-null reference values x, y, and
z, if x.equals(y) returns true and y.equals(z) returns
true, then x.equals(z) should return true. |
public static <T> Optional<ContractViolation> reflexivity(T object)
Object.equals(Object) that this method should evaluate the following contract
condition:
x, x.equals(x)
should return true.
Object.equals(Object)public static <T> Optional<ContractViolation> symmetric(T object, T anotherObject)
Object.equals(Object) that this method should evaluate the following contract
condition:
x and y,
x.equals(y) should return true if and only if y.equals(x) returns
true.
Object.equals(Object)public static <T> Optional<ContractViolation> transitivity(T a, T b, T c)
Object.equals(Object) that this method should evaluate the following contract
condition:
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)public static <T> Optional<ContractViolation> nonNull(T object)
Object.equals(Object) that this method should evaluate the following
contract condition:
x, x.equals(null) should return
false.
Object.equals(Object) public static <T> Optional<ContractViolation> consistency(T object, T anotherObject)
Object.equals(Object) that this method should evaluate the following contract
condition:
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)public static <T> Optional<ContractViolation> consistency(T object, T anotherObject, int iterations)
Object.equals(Object) that this method should evaluate the following contract
condition:
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)public static <T> Optional<ContractViolation> reflexivityAndNonNull(T object)
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)public static <T> Optional<ContractViolation> symmetricAndConsistency(T object, T anotherObject)
Object.equals(Object) that this method should evaluate the following
contract condition:
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)public static <T> Optional<ContractViolation> reflexivityNonNullSymmetricAndConsistency(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)public static <T> Optional<ContractViolation> reflexivityNonNullSymmetricConsistencyAndTransitivity(T object, T otherObject, T anotherObject)
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)Copyright © 2015–2018 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.