# CompatibilityRuleChain

interface CompatibilityRuleChain<T>(source)

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 compatible or 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.

#### Since

3.3

#### Parameters

<T>

the type of the attribute

## Functions

add
Link copied to clipboard
abstract fun add(ruleClass: Class<out AttributeCompatibilityRule<T>>)
Adds an arbitrary compatibility rule to the chain.
abstract fun add(ruleClass: Class<out AttributeCompatibilityRule<T>>, configureAction: Action<in ActionConfiguration>)
Adds an arbitrary compatibility rule to the chain, possibly configuring the rule as well.
add
Link copied to clipboard
inline fun <T : Any> CompatibilityRuleChain<T>.add(ruleClass: KClass<out AttributeCompatibilityRule<T>>)
inline fun <T : Any> CompatibilityRuleChain<T>.add(ruleClass: KClass<out AttributeCompatibilityRule<T>>, configureAction: Action<in ActionConfiguration>)

Kotlin extension function taking kotlin.reflect.KClass for org.gradle.api.attributes.CompatibilityRuleChain.add.

ordered
Link copied to clipboard
abstract fun ordered(comparator: Comparator<in T>)
Adds an ordered check rule to this chain.
reverseOrdered
Link copied to clipboard
abstract fun reverseOrdered(comparator: Comparator<in T>)
Adds an reverse ordered check rule to this chain.