Package com.atlassian.jira.util
Class SimpleErrorCollection
java.lang.Object
com.atlassian.jira.util.SimpleErrorCollection
- All Implemented Interfaces:
ErrorCollection
,Serializable
The most straightforward serializable implementation of ErrorCollection interface.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.jira.util.ErrorCollection
ErrorCollection.Reason
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleErrorCollection
(ErrorCollection errorCollection) SimpleErrorCollection
(String errorMessage) SimpleErrorCollection
(String errorMsg, ErrorCollection.Reason reason) SimpleErrorCollection
(List<String> errorMessages, Set<ErrorCollection.Reason> reasons) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a field-specific error message.void
addError
(String field, String message, ErrorCollection.Reason reason) Add a field-specific error message.void
addErrorCollection
(ErrorCollection errors) Populate this ErrorCollection with general and field-specific errors.void
addErrorMessage
(String message) Add error message relating to system state (not field-specific).void
addErrorMessage
(String message, ErrorCollection.Reason reason) Add error message relating to system state (not field-specific), and a reason.void
addErrorMessages
(Collection<String> incomingMessages) Append new error messages to those already collected.void
Append new field-specific errors to those already collected.void
addReason
(ErrorCollection.Reason reason) Add a reason why the function has not been performed.void
addReasons
(Set<ErrorCollection.Reason> reasons) Add reasons why the function has not been performed.boolean
Get all non field-specific error messages.Get all field-specific errors.Get error messages, then get rid of them.A set of well known reasons why the function has not been performed.boolean
Whether any errors (of any type - field-specific or otherwise) have been collected.int
hashCode()
void
setErrorMessages
(Collection<String> errorMessages) Populate this ErrorCollection with a new set of messages (existing errors are lost).void
setReasons
(Set<ErrorCollection.Reason> reasons) Set reasons why the function has not been performed.toString()
-
Constructor Details
-
SimpleErrorCollection
public SimpleErrorCollection() -
SimpleErrorCollection
-
SimpleErrorCollection
-
SimpleErrorCollection
-
SimpleErrorCollection
-
-
Method Details
-
addError
Description copied from interface:ErrorCollection
Add a field-specific error message.- Specified by:
addError
in interfaceErrorCollection
- Parameters:
field
- Field name, eg. "assignee"message
- Error message.
-
addErrorMessage
Description copied from interface:ErrorCollection
Add error message relating to system state (not field-specific).- Specified by:
addErrorMessage
in interfaceErrorCollection
- Parameters:
message
- Error message.
-
getErrorMessages
Description copied from interface:ErrorCollection
Get all non field-specific error messages.- Specified by:
getErrorMessages
in interfaceErrorCollection
- Returns:
- Collection of error Strings.
-
setErrorMessages
Description copied from interface:ErrorCollection
Populate this ErrorCollection with a new set of messages (existing errors are lost).- Specified by:
setErrorMessages
in interfaceErrorCollection
- Parameters:
errorMessages
- List of error messageString
s.
-
getFlushedErrorMessages
Description copied from interface:ErrorCollection
Get error messages, then get rid of them.- Specified by:
getFlushedErrorMessages
in interfaceErrorCollection
- Returns:
- The (now cleared) error messages.
-
getErrors
Description copied from interface:ErrorCollection
Get all field-specific errors.- Specified by:
getErrors
in interfaceErrorCollection
- Returns:
- Map of String: String pairs, eg. {"assignee": "Assignee is required"}
-
addErrorCollection
Description copied from interface:ErrorCollection
Populate this ErrorCollection with general and field-specific errors.- Specified by:
addErrorCollection
in interfaceErrorCollection
- Parameters:
errors
- ErrorCollection whose errors/messages we obtain.
-
addErrorMessages
Description copied from interface:ErrorCollection
Append new error messages to those already collected.- Specified by:
addErrorMessages
in interfaceErrorCollection
- Parameters:
incomingMessages
- Collection of error strings.
-
addErrors
Description copied from interface:ErrorCollection
Append new field-specific errors to those already collected.- Specified by:
addErrors
in interfaceErrorCollection
- Parameters:
incomingErrors
- of String: String pairs, eg. {"assignee": "Assignee is required"}
-
hasAnyErrors
public boolean hasAnyErrors()Description copied from interface:ErrorCollection
Whether any errors (of any type - field-specific or otherwise) have been collected.- Specified by:
hasAnyErrors
in interfaceErrorCollection
- Returns:
- true if any errors (of any type - field-specific or otherwise) have been collected.
-
addError
Description copied from interface:ErrorCollection
Add a field-specific error message.- Specified by:
addError
in interfaceErrorCollection
- Parameters:
field
- Field name, eg. "assignee"message
- Error message.reason
- Reason for the error.
-
addErrorMessage
Description copied from interface:ErrorCollection
Add error message relating to system state (not field-specific), and a reason.- Specified by:
addErrorMessage
in interfaceErrorCollection
- Parameters:
message
- Error message.reason
- Reason for the error.
-
addReason
Description copied from interface:ErrorCollection
Add a reason why the function has not been performed. The reasons may be used by callers of services to set return codes etc. for example in REST services.- Specified by:
addReason
in interfaceErrorCollection
- Parameters:
reason
- a well known reasons why the function has not been performed.
-
addReasons
Description copied from interface:ErrorCollection
Add reasons why the function has not been performed. The reasons may be used by callers of services to set return codes etc. for example in REST services.- Specified by:
addReasons
in interfaceErrorCollection
- Parameters:
reasons
- a set of well known reasons why the function has not been performed.
-
setReasons
Description copied from interface:ErrorCollection
Set reasons why the function has not been performed. The reasons may be used by callers of services to set return codes etc. for example in REST services.- Specified by:
setReasons
in interfaceErrorCollection
- Parameters:
reasons
- a set of well known reasons why the function has not been performed.
-
getReasons
Description copied from interface:ErrorCollection
A set of well known reasons why the function has not been performed. The reasons may be used by callers of services to set return codes etc. for example in REST services.- Specified by:
getReasons
in interfaceErrorCollection
- Returns:
- a set of well known reasons why the function has not been performed.
-
toString
-
equals
-
hashCode
public int hashCode()
-