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

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

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

import java.util.function.Predicate;

final class RuleDefinition implements Rule {

    private final Predicate predicate;
    private final String failMessage;

    RuleDefinition(Predicate predicate, String failMessage) {
        this.predicate = predicate;
        this.failMessage = failMessage;
    }

    @Override
    public String getFailMessage() {
        return failMessage;
    }

    @Override
    public boolean test(T value) {
        return predicate.test(value);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy