Package com.atlassian.jira.util
Class ErrorCollections
java.lang.Object
com.atlassian.jira.util.ErrorCollections
Static factory methods for creating simple
ErrorCollection instances.
All instances returned by methods in this class are Serializable.
- Since:
- v7.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ErrorCollectioncopyOf(ErrorCollection errorCollection) Creates a new error collection with contents copied from the supplied argument.static ErrorCollectioncreate(String errorMessage, ErrorCollection.Reason reason) Creates a new instance of error collection that contains the specified message and reason.static ErrorCollectioncreate(String field, String message, ErrorCollection.Reason reason) Creates a new instance of error collection that contains themessagerelated to thefieldbecause ofreason.static ErrorCollectionempty()Creates a new instance of empty error collection.static ErrorCollectionjoin(ErrorCollection... errorCollections) Creates an error collection containing all errors from given error collectionsstatic ErrorCollectionvalidationError(String field, String message) Creates a new instance of error collection that indicates there was a validation error for the specified field.
-
Constructor Details
-
ErrorCollections
public ErrorCollections()
-
-
Method Details
-
empty
Creates a new instance of empty error collection.- Returns:
- empty error collection
-
create
Creates a new instance of error collection that contains the specified message and reason.- Parameters:
errorMessage- error message to be contained in the returned collectionreason- reason for the message- Returns:
- a new error collection with the specified message and reason
-
create
Creates a new instance of error collection that contains themessagerelated to thefieldbecause ofreason.- Parameters:
field- field that the error message will pertain tomessage- error message related to the fieldreason- reason for error- Returns:
- a new error collection with one message relating to the field
-
validationError
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 reasonErrorCollection.Reason.VALIDATION_FAILED.- Parameters:
field- field that failed validationmessage- detailed error message- Returns:
- a new error collection with validation reason set to
ErrorCollection.Reason.VALIDATION_FAILED
-
copyOf
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
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
-