@Incubating interface CompatibilityRuleChain<T : Any>
A chain of compatibility checks, implemented as action rules. By default the chain is empty and will eventually tell the values are incompatible if no rule expressed an opinion.
For a given set of rules, the execution is done in order, and interrupts as soon as a rule expressed an option (through CompatibilityCheckDetails#compatible()
or CompatibilityCheckDetails#incompatible()
).
If the end of the rule chain is reached and that no rule expressed an opinion then we apply an equality check by default, and eventually fail if they are not equal.
abstract fun add(rule: Class<out AttributeCompatibilityRule<T>>): Unit
Adds an arbitrary compatibility rule to the chain. A compatibility rule can tell if two values are compatible. Compatibility doesn't mean equality. Typically two different Java platforms can be compatible, without being equal. A rule can express an opinion by calling the @{link abstract fun add(rule: Class<out AttributeCompatibilityRule<T>>, configureAction: Action<in ActionConfiguration>): Unit
Adds an arbitrary compatibility rule to the chain, possibly configuring the rule as well. |
|
abstract fun ordered(comparator: Comparator<in T>): Unit
Adds an ordered check rule to this chain. |
|
abstract fun reverseOrdered(comparator: Comparator<in T>): Unit
Adds an reverse ordered check rule to this chain. |