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 TypeMethodDescriptionvoidAdd a field-specific error message.voidaddError(String field, String message, ErrorCollection.Reason reason) Add a field-specific error message.voidaddErrorCollection(ErrorCollection errors) Populate this ErrorCollection with general and field-specific errors.voidaddErrorMessage(String message) Add error message relating to system state (not field-specific).voidaddErrorMessage(String message, ErrorCollection.Reason reason) Add error message relating to system state (not field-specific), and a reason.voidaddErrorMessages(Collection<String> incomingMessages) Append new error messages to those already collected.voidAppend new field-specific errors to those already collected.voidaddReason(ErrorCollection.Reason reason) Add a reason why the function has not been performed.voidaddReasons(Set<ErrorCollection.Reason> reasons) Add reasons why the function has not been performed.booleanGet 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.booleanWhether any errors (of any type - field-specific or otherwise) have been collected.inthashCode()voidsetErrorMessages(Collection<String> errorMessages) Populate this ErrorCollection with a new set of messages (existing errors are lost).voidsetReasons(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:ErrorCollectionAdd a field-specific error message.- Specified by:
addErrorin interfaceErrorCollection- Parameters:
field- Field name, eg. "assignee"message- Error message.
-
addErrorMessage
Description copied from interface:ErrorCollectionAdd error message relating to system state (not field-specific).- Specified by:
addErrorMessagein interfaceErrorCollection- Parameters:
message- Error message.
-
getErrorMessages
Description copied from interface:ErrorCollectionGet all non field-specific error messages.- Specified by:
getErrorMessagesin interfaceErrorCollection- Returns:
- Collection of error Strings.
-
setErrorMessages
Description copied from interface:ErrorCollectionPopulate this ErrorCollection with a new set of messages (existing errors are lost).- Specified by:
setErrorMessagesin interfaceErrorCollection- Parameters:
errorMessages- List of error messageStrings.
-
getFlushedErrorMessages
Description copied from interface:ErrorCollectionGet error messages, then get rid of them.- Specified by:
getFlushedErrorMessagesin interfaceErrorCollection- Returns:
- The (now cleared) error messages.
-
getErrors
Description copied from interface:ErrorCollectionGet all field-specific errors.- Specified by:
getErrorsin interfaceErrorCollection- Returns:
- Map of String: String pairs, eg. {"assignee": "Assignee is required"}
-
addErrorCollection
Description copied from interface:ErrorCollectionPopulate this ErrorCollection with general and field-specific errors.- Specified by:
addErrorCollectionin interfaceErrorCollection- Parameters:
errors- ErrorCollection whose errors/messages we obtain.
-
addErrorMessages
Description copied from interface:ErrorCollectionAppend new error messages to those already collected.- Specified by:
addErrorMessagesin interfaceErrorCollection- Parameters:
incomingMessages- Collection of error strings.
-
addErrors
Description copied from interface:ErrorCollectionAppend new field-specific errors to those already collected.- Specified by:
addErrorsin interfaceErrorCollection- Parameters:
incomingErrors- of String: String pairs, eg. {"assignee": "Assignee is required"}
-
hasAnyErrors
public boolean hasAnyErrors()Description copied from interface:ErrorCollectionWhether any errors (of any type - field-specific or otherwise) have been collected.- Specified by:
hasAnyErrorsin interfaceErrorCollection- Returns:
- true if any errors (of any type - field-specific or otherwise) have been collected.
-
addError
Description copied from interface:ErrorCollectionAdd a field-specific error message.- Specified by:
addErrorin interfaceErrorCollection- Parameters:
field- Field name, eg. "assignee"message- Error message.reason- Reason for the error.
-
addErrorMessage
Description copied from interface:ErrorCollectionAdd error message relating to system state (not field-specific), and a reason.- Specified by:
addErrorMessagein interfaceErrorCollection- Parameters:
message- Error message.reason- Reason for the error.
-
addReason
Description copied from interface:ErrorCollectionAdd 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:
addReasonin interfaceErrorCollection- Parameters:
reason- a well known reasons why the function has not been performed.
-
addReasons
Description copied from interface:ErrorCollectionAdd 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:
addReasonsin interfaceErrorCollection- Parameters:
reasons- a set of well known reasons why the function has not been performed.
-
setReasons
Description copied from interface:ErrorCollectionSet 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:
setReasonsin interfaceErrorCollection- Parameters:
reasons- a set of well known reasons why the function has not been performed.
-
getReasons
Description copied from interface:ErrorCollectionA 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:
getReasonsin interfaceErrorCollection- Returns:
- a set of well known reasons why the function has not been performed.
-
toString
-
equals
-
hashCode
public int hashCode()
-