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

org.solidcoding.validation.api.RuleValidationBuilder Maven / Gradle / Ivy

There is a newer version: 2.0.1
Show newest version
package org.solidcoding.validation.api;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

final class RuleValidationBuilder implements ValidationBuilder {

    private final T value;
    private final List> ruleDefinitions;

    public RuleValidationBuilder(T value) {
        this.value = value;
        this.ruleDefinitions = new ArrayList<>();
    }

    @Override
    public ContinuingValidator compliesWith(Rule rule) {
        ruleDefinitions.add(rule);
        return new ContinuingPredicateValidator<>(ruleDefinitions, value);
    }

    @Override

    public ContinuingValidator compliesWith(Collection> rules) {
        ruleDefinitions.addAll(rules);
        return new ContinuingPredicateValidator<>(ruleDefinitions, value);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy