All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gradle.api.attributes.CompatibilityRuleChain Maven / Gradle / Ivy

There is a newer version: 8.6
Show newest version
/*
 * Copyright 2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.gradle.api.attributes;

import org.gradle.api.Action;
import org.gradle.api.ActionConfiguration;
import org.gradle.internal.HasInternalProtocol;

import java.util.Comparator;

/**
 * 

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 {@link CompatibilityCheckDetails#compatible()} or {@link 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.

* * @param the type of the attribute */ @HasInternalProtocol public interface CompatibilityRuleChain { /** * Adds an ordered check rule to this chain. * * @param comparator the comparator to use */ void ordered(Comparator comparator); /** * Adds an reverse ordered check rule to this chain. * * @param comparator the comparator to use */ void reverseOrdered(Comparator comparator); /** *

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

* * @param rule the rule to add to the chain * @since 4.0 */ void add(Class> rule); /** *

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

* * @param rule the rule to add to the chain * @param configureAction the action to use to configure the rule * @since 4.0 */ void add(Class> rule, Action configureAction); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy