Class NotEmptyValidator<T>

java.lang.Object
io.jmix.ui.component.validation.AbstractValidator<T>
io.jmix.ui.component.validation.NotEmptyValidator<T>
Type Parameters:
T - Collection or String
All Implemented Interfaces:
Validator<T>, Consumer<T>

@Component("ui_NotEmptyValidator") @Scope("prototype") public class NotEmptyValidator<T> extends AbstractValidator<T>
NotEmpty validator checks that value is not null and not empty.

For error message it uses template string and it is possible to use '${value}' keys for formatted output.

Note, that size validator for Collection doesn't use key 'value' for output error message.

In order to provide your own implementation globally, create a subclass and register it in configuration class, for example:

     @Bean("ui_NotEmptyValidator")
     @Scope(BeanDefinition.SCOPE_PROTOTYPE)
     @Primary
     protected NotEmptyValidator notEmptyValidator() {
          return new CustomNotEmptyValidator();
     }
 
  • Constructor Details

    • NotEmptyValidator

      public NotEmptyValidator()
    • NotEmptyValidator

      public NotEmptyValidator(String message)
      Constructor for custom error message.
      Parameters:
      message - error message
  • Method Details