A DiscriminableDiscriminator discriminates objects that implement the Discriminable interface. Discriminators exist for a wide variety of Java built-in types, but not for any generic object. This Discriminator discriminates Discriminable objects by calling the object's getDiscriminableProperties() method to obtain a list of property names to discriminate. Then it delegates to a PropertiesDiscriminator to discriminate the objects based on the values of those properties.
Given the class...
public class Widget implements Discriminable { private int a; private int b; public Widget(int a, int b) {this.a = a; this.b = b;} public int getA() { return a; } public int getB() { return b; } public int getResult() { return a + b; } public List<String> getDiscriminableProperties() { return Arrays.asList("result"); } }
... and the input...
... a DiscriminableDiscriminator returns the following equivalence classes: