Class DigitsValidator<T>

java.lang.Object
io.jmix.flowui.component.validation.AbstractValidator<T>
io.jmix.flowui.component.validation.DigitsValidator<T>
All Implemented Interfaces:
Validator<T>, Consumer<T>, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

@Component("flowui_DigitsValidator") @Scope("prototype") public class DigitsValidator<T> extends AbstractValidator<T> implements org.springframework.beans.factory.InitializingBean
  • Field Details

    • integer

      protected int integer
    • fraction

      protected int fraction
  • Constructor Details

    • DigitsValidator

      public DigitsValidator()
    • DigitsValidator

      public DigitsValidator(int integer, int fraction)
      Constructor with default error message.
      Parameters:
      integer - maximum number of integral digits
      fraction - maximum number of fractional digits
    • DigitsValidator

      public DigitsValidator(int integer, int fraction, String message)
      Constructor with custom error message. This message can contain '${value}', '${integer}' and '${fraction}' keys for formatted output.

      Example: "Value '${value}' is out of bounds ('${integer}' digits is expected in integer part and '${fraction}' in fractional part)".

      Parameters:
      integer - maximum number of integral digits
      fraction - maximum number of fractional digits
      message - error message
  • Method Details

    • setInteger

      public void setInteger(int integer)
      Sets maximum value inclusive.
      Parameters:
      integer - maximum number of integral digits
    • setFraction

      public void setFraction(int fraction)
      Sets maximum value inclusive.
      Parameters:
      fraction - maximum number of fractional digits
    • getInteger

      public int getInteger()
      Returns:
      maximum number of integral digits
    • getFraction

      public int getFraction()
      Returns:
      maximum number of fractional digits
    • accept

      public void accept(@Nullable T value) throws ValidationException
      Description copied from interface: Validator
      Checks a value.
      Specified by:
      accept in interface Consumer<T>
      Specified by:
      accept in interface Validator<T>
      Parameters:
      value - a value
      Throws:
      ValidationException
    • fireValidationException

      protected void fireValidationException(T value)