Class AbstractValidator<T>

java.lang.Object
io.jmix.ui.component.validation.AbstractValidator<T>
Type Parameters:
T - value type
All Implemented Interfaces:
Validator<T>, Consumer<T>
Direct Known Subclasses:
DecimalMaxValidator, DecimalMinValidator, DigitsValidator, DoubleMaxValidator, DoubleMinValidator, EmailValidator, FutureOrPresentValidator, FutureValidator, GroovyScriptValidator, JsonConfigValidator, MaxValidator, MinValidator, NegativeOrZeroValidator, NegativeValidator, NotBlankValidator, NotEmptyValidator, NotNullValidator, OutputFileNameValidator, PastOrPresentValidator, PastValidator, PositiveOrZeroValidator, PositiveValidator, RegexpValidator, ReportBandNameValidator, ReportCollectionValidator, ReportParamAliasValidator, ReportParamFieldValidator, SizeValidator

public abstract class AbstractValidator<T> extends Object implements Validator<T>
Main class for validators.
  • Field Details

  • Constructor Details

    • AbstractValidator

      public AbstractValidator()
  • Method Details

    • getMessage

      @Nullable public String getMessage()
      Returns:
      custom error message
    • setMessage

      @StudioProperty(type=LOCALIZED_STRING) public void setMessage(@Nullable String message)
      Sets custom error message that will be used instead of default message. For error message it uses template string and it is possible to use values in message. Each validator has its own value keys for formatted output. See JavaDocs for specific validator.
      Parameters:
      message - error message
    • getTemplateErrorMessage

      protected String getTemplateErrorMessage(@Nullable String errorMessage, Map<String,Object> valuesMap)
      Parameters:
      errorMessage - error message
      valuesMap - values map
      Returns:
      message with inserted values
    • formatValue

      protected String formatValue(Object value)