Class MaxValidator<T extends Number>

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

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

    • max

      protected int max
    • defaultMessage

      protected String defaultMessage
  • Constructor Details

    • MaxValidator

      public MaxValidator()
    • MaxValidator

      public MaxValidator(int max)
    • MaxValidator

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

      Example: "Value '${value}' should be greater than or equal to '${min}'".

      Parameters:
      max - min value
      message - error message
  • Method Details

    • setMax

      public void setMax(int max)
      Sets max value of the range. Max value cannot be less than 0. Default value is Integer.MAX_VALUE.

      Note, max value is included in range. Examples:

      
        value = 5, max = 5 - is valid
        value = 6, max = 5 - is not valid
       
       
      Parameters:
      max - max value
    • getMax

      public long getMax()
      Returns:
      max value
    • accept

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