I'm using the Joiners class to make a Constraint. The Joiners class has methods like equal(), greaterThan(), lessThanOrEqual(), etc. I want to use a method such as "notEqual()" because I want to compare two objects of the same class, and assign a penalty if the value for a property is not the same. Please note that I use Joiners.lessThan(..id..) to ensure that I am comparing pairs of objects without doing it twice. This is an example of code I'd like to be able to write:
private Constraint someConflict(ConstraintFactory cf) {
return cf.from(A.class)
.join(A.class, // Pair the above A with this A
Joiners.notEqual(A::getSomething), // ..if they have differing Something
Joiners.lessThan(A::getId)) // ..and if the pair is unique (no reverse pairs)
.penalizeConfigurable();
}
The "notEqual" will fail as it doesn't exist, obviously. Is there a way to do this? It seems logical that this kind of operation should be possible. If not, could I please be enlightened? Thanks in advance.