Interface Validatable

  • All Known Implementing Classes:
    ValidationSupport

    public interface Validatable
    Top interface to make something validatable. Top interface to make something validatable.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addFailedValidator​(Validator validator, String errorKey)
      This method is not to add validators for future processing.
      Errors errors()
      Provides an instance of localized Errors object, filled with error messages after validation.
      Errors errors​(Locale locale)
      Provides an instance of localized Errors object, filled with error messages after validation.
      Object get​(String attribute)
      Used by validators to get values
      boolean isValid()
      Implementation should call {#link validate()} internally.
      void validate()
      Runs validation.
      void validate​(boolean reset)
      Runs validation.
    • Method Detail

      • get

        Object get​(String attribute)
        Used by validators to get values
        Parameters:
        attribute - name of attribute
        Returns:
        value of attribute
      • addFailedValidator

        void addFailedValidator​(Validator validator,
                                String errorKey)
        This method is not to add validators for future processing. This is instead used to add validators and their respective error messages in case those validators fail.
        Parameters:
        validator - validator that failed validation (later to be used to retrieve error message)
        errorKey - - generally an attribute name that failed validation
      • isValid

        boolean isValid()
        Implementation should call {#link validate()} internally.
        Returns:
        true if object is valid.
      • validate

        void validate()
        Runs validation. Will blow away any previous validation errors.
      • validate

        void validate​(boolean reset)
        Runs validation.
        Parameters:
        reset - true to reset all previous validation errors.
      • errors

        Errors errors()
        Provides an instance of localized Errors object, filled with error messages after validation.
        Returns:
        an instance of localized Errors object, filled with error messages after validation.
      • errors

        Errors errors​(Locale locale)
        Provides an instance of localized Errors object, filled with error messages after validation.
        Parameters:
        locale - locale to pick the right resource bundle.
        Returns:
        an instance of localized Errors object, filled with error messages after validation.