
org.swiftboot.web.validate.constraintvalidator.OnlyNumberValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swiftboot-web Show documentation
Show all versions of swiftboot-web Show documentation
Basic module for enterprise web applications
package org.swiftboot.web.validate.constraintvalidator;
import org.apache.commons.lang3.StringUtils;
import org.swiftboot.web.validate.constraint.OnlyNumber;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
/**
*
* @author swiftech
* @since 1.1.1
*/
public class OnlyNumberValidator implements ConstraintValidator {
private OnlyNumber onlyNumber;
@Override
public void initialize(OnlyNumber constraintAnnotation) {
this.onlyNumber = constraintAnnotation;
}
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
return StringUtils.isNumeric(value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy