Class ErrorCollections

java.lang.Object
com.atlassian.jira.util.ErrorCollections

@ExperimentalApi public class ErrorCollections extends Object
Static factory methods for creating simple ErrorCollection instances.

All instances returned by methods in this class are Serializable.

Since:
v7.0
  • Constructor Details

    • ErrorCollections

      public ErrorCollections()
  • Method Details

    • empty

      public static ErrorCollection empty()
      Creates a new instance of empty error collection.
      Returns:
      empty error collection
    • create

      public static ErrorCollection create(String errorMessage, ErrorCollection.Reason reason)
      Creates a new instance of error collection that contains the specified message and reason.
      Parameters:
      errorMessage - error message to be contained in the returned collection
      reason - reason for the message
      Returns:
      a new error collection with the specified message and reason
    • create

      public static ErrorCollection create(String field, String message, ErrorCollection.Reason reason)
      Creates a new instance of error collection that contains the message related to the field because of reason.
      Parameters:
      field - field that the error message will pertain to
      message - error message related to the field
      reason - reason for error
      Returns:
      a new error collection with one message relating to the field
    • validationError

      public static ErrorCollection validationError(String field, String message)
      Creates a new instance of error collection that indicates there was a validation error for the specified field.

      This is equivalent to calling create(String, String, com.atlassian.jira.util.ErrorCollection.Reason) with the same field and message arguments and reason ErrorCollection.Reason.VALIDATION_FAILED.

      Parameters:
      field - field that failed validation
      message - detailed error message
      Returns:
      a new error collection with validation reason set to ErrorCollection.Reason.VALIDATION_FAILED
    • copyOf

      public static ErrorCollection copyOf(ErrorCollection errorCollection)
      Creates a new error collection with contents copied from the supplied argument.
      Parameters:
      errorCollection - error collection to copy
      Returns:
      a new instance of error collection with the same contents as argument
    • join

      public static ErrorCollection join(ErrorCollection... errorCollections)
      Creates an error collection containing all errors from given error collections
      Parameters:
      errorCollections - an array of error collections to join
      Returns:
      error collection containing all errors from given error collections