Class IntegerRangeValidator

java.lang.Object
com.jbstrap.core.validators.IntegerRangeValidator
All Implemented Interfaces:
DataRangeValidator, DataValidator

public class IntegerRangeValidator extends Object implements DataRangeValidator
Integer range validator class
Since:
4.0
Author:
JBStrap
  • Constructor Details

    • IntegerRangeValidator

      public IntegerRangeValidator()
  • Method Details

    • validateData

      public String validateData(Object data, String language)

      Validates the specified data

      The specified data is validated, if it can be converted into an Integer, and this converted data is between the range. If it is exactly the minimum or maximum value, it will be validated.

      The error message can be customized with the validator.floatValidatorError properties file key. This is also used to implement language specific error messages. For more information about language specific messages, see: MessageSourceAPI

      Specified by:
      validateData in interface DataValidator
      Parameters:
      data - The data to be validated
      language - The language code of the error message. If not specified, the default language will be used. The default language can be set with the DEFAULT_LANGUAGE JBStrap parameter.
      Returns:
      The specified error message or null, if the validation found no errors.
    • setMin

      public void setMin(Object minValue)
      Sets the minimum valid value.
      Specified by:
      setMin in interface DataRangeValidator
      Parameters:
      minValue - The minimum value
    • setMax

      public void setMax(Object maxValue)
      Sets the maximum valid value.
      Specified by:
      setMax in interface DataRangeValidator
      Parameters:
      maxValue - The maximum value