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

colesico.framework.dslvalidator.commands.ConditionalChain Maven / Gradle / Ivy

There is a newer version: 5.3.0
Show newest version
package colesico.framework.dslvalidator.commands;

import colesico.framework.dslvalidator.ValidationContext;

import java.util.function.Predicate;

/**
 * Executes chain commands if condition is met.
 *
 * @see ChainSequence
 */
public class ConditionalChain extends AbstractSequence {

    private final Predicate condition;

    public ConditionalChain(Predicate condition) {
        this.condition = condition;
    }

    @Override
    public void execute(ValidationContext context) {
        if (condition.test(context)) {
            executeChain(context);
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy