Interface ErrorCollection

    • Method Detail

      • addError

        void addError​(String field,
                      String message)
        Add a field-specific error message.
        Parameters:
        field - Field name, eg. "assignee"
        message - Error message.
      • addError

        void addError​(String prefix,
                      String field,
                      String message)
        Adds a new form validation error with a given prefix. ie. prefix of "builder.ant" and field "target" will result in a key of "builder.ant.target"
        Parameters:
        prefix - The prefix of the field in . form
        field - The id of the form element in error
        message - The error message to display to the user
      • addErrorMessage

        String addErrorMessage​(String message)
        Add error message relating to system state (not field-specific).
        Parameters:
        message - Error message.
      • getErrorMessages

        Collection<String> getErrorMessages()
        Get all non field-specific error messages.
        Returns:
        Collection of error Strings.
      • setErrorMessages

        void setErrorMessages​(Collection<String> errorMessages)
        Populate this ErrorCollection with a new set of messages (existing errors are lost).
        Parameters:
        errorMessages - List of error message Strings.
      • getFlushedErrorMessages

        Collection<String> getFlushedErrorMessages()
        Get error messages, then get rid of them.
        Returns:
        The (now cleared) error messages.
      • getErrors

        Map<String,​List<String>> getErrors()
        Get all field-specific errors.
        Returns:
        Map of String: String pairs, eg. {"assignee": "Assignee is required"}
      • addErrorCollection

        void addErrorCollection​(@NotNull
                                @NotNull ErrorCollection errors)
        Populate this ErrorCollection with general and field-specific errors.
        Parameters:
        errors - ErrorCollection whose errors/messages we obtain.
      • addErrorMessages

        void addErrorMessages​(Collection<String> errorMessages)
        Append new error messages to those already collected.
        Parameters:
        errorMessages - Collection of error strings.
      • addFieldErrors

        void addFieldErrors​(Map<String,​List<String>> errors)
        Append new field-specific errors to those already collected.
        Parameters:
        errors - A Map from String field names, to String error messages, or Collections of String error messages.
      • hasAnyErrors

        boolean hasAnyErrors()
        Whether any errors (of any type - field-specific or otherwise) have been collected.
        Returns:
        true if there are errors; false otherwise.
      • getTotalErrors

        int getTotalErrors()
      • getAllErrorMessages

        @NotNull
        default @NotNull List<String> getAllErrorMessages()
        Get all error messages from this error collection. Includes error messages and field errors. Field names are skipped.