org.srplib.validation.ConstantValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of srp-validation-support Show documentation
Show all versions of srp-validation-support Show documentation
Single Responsibility Principle (SRP) libraries collection
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);
}
}