CompatibilityRuleChain (Gradle API 8.11.1)

Package org.gradle.api.attributes

## Interface CompatibilityRuleChain<T>

- Type Parameters:
    `T` - the type of the attribute

      public interface CompatibilityRuleChain<T>

  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.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `add​(java.lang.Class<? extends AttributeCompatibilityRule<T>> rule)` | Adds an arbitrary compatibility rule to the chain.
    `void` | `add​(java.lang.Class<? extends AttributeCompatibilityRule<T>> rule, Action<? super ActionConfiguration> configureAction)` | Adds an arbitrary compatibility rule to the chain, possibly configuring the rule as well.
    `void` | `ordered​(java.util.Comparator<? super T> comparator)` | Adds an ordered check rule to this chain.
    `void` | `reverseOrdered​(java.util.Comparator<? super T> comparator)` | Adds an reverse ordered check rule to this chain.

- - ### Method Detail

    - #### ordered

          void ordered​(java.util.Comparator<? super T> comparator)

      Adds an ordered check rule to this chain.
      Parameters:
        `comparator` - the comparator to use

    - #### reverseOrdered

          void reverseOrdered​(java.util.Comparator<? super T> comparator)

      Adds an reverse ordered check rule to this chain.
      Parameters:
        `comparator` - the comparator to use

    - #### add

          void add​(java.lang.Class<? extends AttributeCompatibilityRule<T>> rule)

      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 `CompatibilityCheckDetails.compatible()`} method to tell that two attributes are compatible, or it can call `CompatibilityCheckDetails.incompatible()` to say that they are not compatible. It is not mandatory for a rule to express an opinion.

      Parameters:
        `rule` - the rule to add to the chain
      Since:
        4.0

    - #### add

          void add​(java.lang.Class<? extends AttributeCompatibilityRule<T>> rule,
                   Action<? super ActionConfiguration> configureAction)

      Adds an arbitrary compatibility rule to the chain, possibly configuring the rule as well.

      Parameters:
        `rule` - the rule to add to the chain
        `configureAction` - the action to use to configure the rule
      Since:
        4.0