Class AbstractValidator<T>

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

public abstract class AbstractValidator<T> extends Object implements Validator<T>, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
Main class for validators.
  • Field Details

    • messages

      protected Messages messages
    • currentAuthentication

      protected CurrentAuthentication currentAuthentication
    • datatypeRegistry

      protected DatatypeRegistry datatypeRegistry
    • substitutor

      protected StringSubstitutor substitutor
    • applicationContext

      protected org.springframework.context.ApplicationContext applicationContext
    • message

      protected String message
    • defaultMessage

      protected String defaultMessage
  • Constructor Details

    • AbstractValidator

      public AbstractValidator()
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • getMessage

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

      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)
    • fireValidationException

      protected void fireValidationException(String errorMessage)
    • fireValidationException

      protected void fireValidationException(String errorMessage, Map<String,Object> map)