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

org.swiftboot.web.validate.constraintvalidator.OnlyNumberValidator Maven / Gradle / Ivy

There is a newer version: 2.4.7
Show newest version
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