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

org.srplib.validation.ConstantValidator Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package org.srplib.validation;

/**
 * Validates strings with regular expression.
 *
 * @author Anton Pechinsky
 */
public class ConstantValidator extends org.srplib.validation.AbstractValidator {

    private final boolean valid;

    private final String message;

    public ConstantValidator(boolean valid, String message) {
        this.valid = valid;
        this.message = message;
    }

    protected boolean isValid(Validatable validatable) {
        return valid;
    }

    protected ValidationError newError() {
        return Validators.newError(message);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy