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

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

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

/**
 * Validates if value is null.
 *
 * TODO: do we need this validators if required validation is a special case in validation process?
 *
 * @author Anton Pechinsky
 */
public class RequiredValidator extends org.srplib.validation.AbstractValidator {

    @Override
    protected boolean isValid(Validatable validatable) {
        return validatable.getValue() != null;
    }

    @Override
    protected ValidationError newError() {
        return Validators.newError("Value should not be null");
    }
}