plus.jdk.validator.Max Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of validator-plus Show documentation
Show all versions of validator-plus Show documentation
A simple input parameter verification component
The newest version!
package plus.jdk.validator;
import plus.jdk.ananotaions.ValidationRule;
import plus.jdk.common.IValidator;
import plus.jdk.common.ValidateException;
import java.lang.reflect.Field;
public class Max implements IValidator {
@Override
public void validate(ValidationRule validationRule, String fieldName, Object fieldValue, Field field, Object input, Object args) throws ValidateException {
double value = Double.parseDouble(String.valueOf(fieldValue));
double argsValue = (double) args;
if(value > argsValue) {
throw new ValidateException(validationRule.message());
}
}
}