Class ValidatorAdapter

All Implemented Interfaces:
Direct Known Subclasses:
AttributeLengthValidator, AttributePresenceValidator, DateValidator, ImplicitConversionValidator, JSONValidator, NumericValidator, RangeValidator, RegexpValidator, TimestampValidator

public abstract class ValidatorAdapter extends Object implements Validator
Subclass this class to create custom validators.
Igor Polevoy
  • Constructor Details

    • ValidatorAdapter

      public ValidatorAdapter()
  • Method Details

    • setMessage

      public final void setMessage(String message)
      Description copied from interface: Validator
      Sets an message on this validator.
      Specified by:
      setMessage in interface Validator
      message - error message.
    • formatMessage

      public String formatMessage(Locale locale, Object... params)
      Provides default implementation, will look for a property in resource bundle, using set message as key. If property in resource bundle not found, treats message verbatim.
      Specified by:
      formatMessage in interface Validator
      locale - locale to use, or null for default locale.
      params - parameters in case a message is parametrized.
      formatted message.
    • getMessage

      public final String getMessage()
    • pinMessage

      public void pinMessage()
      Description copied from interface: Validator
      Will pin the current message. It will ignore any messages generated duringt validation and will use a current message.
      Specified by:
      pinMessage in interface Validator