@PublicApi public class

SimpleErrorCollection

extends Object
implements ErrorCollection Serializable
java.lang.Object
   ↳ com.atlassian.jira.util.SimpleErrorCollection

@PublicApi

This class is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

The most straightforward serializable implementation of ErrorCollection interface.

Summary

Public Constructors
SimpleErrorCollection()
SimpleErrorCollection(String errorMsg, ErrorCollection.Reason reason)
SimpleErrorCollection(List<String> errorMessages, Set<ErrorCollection.Reason> reasons)
SimpleErrorCollection(ErrorCollection errorCollection)
Public Methods
void addError(String field, String message)
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, ErrorCollection.Reason reason)
Add error message relating to system state (not field-specific), and a reason.
void addErrorMessage(String message)
Add error message relating to system state (not field-specific).
void addErrorMessages(Collection<String> incomingMessages)
Append new error messages to those already collected.
void addErrors(Map<StringString> incomingErrors)
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 equals(Object o)
Collection<String> getErrorMessages()
Get all non field-specific error messages.
Map<StringString> getErrors()
Get all field-specific errors.
Collection<String> getFlushedErrorMessages()
Get error messages, then get rid of them.
Set<ErrorCollection.Reason> getReasons()
A set of well known reasons why the function has not been performed.
boolean hasAnyErrors()
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.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.util.ErrorCollection

Public Constructors

public SimpleErrorCollection ()

public SimpleErrorCollection (String errorMsg, ErrorCollection.Reason reason)

public SimpleErrorCollection (List<String> errorMessages, Set<ErrorCollection.Reason> reasons)

public SimpleErrorCollection (ErrorCollection errorCollection)

Public Methods

public void addError (String field, String message)

Add a field-specific error message.

Parameters
field Field name, eg. "assignee"
message Error message.

public void addError (String field, String message, ErrorCollection.Reason reason)

Add a field-specific error message.

Parameters
field Field name, eg. "assignee"
message Error message.
reason Reason for the error.

public void addErrorCollection (ErrorCollection errors)

Populate this ErrorCollection with general and field-specific errors.

Parameters
errors ErrorCollection whose errors/messages we obtain.

public void addErrorMessage (String message, ErrorCollection.Reason reason)

Add error message relating to system state (not field-specific), and a reason.

Parameters
message Error message.
reason Reason for the error.

public void addErrorMessage (String message)

Add error message relating to system state (not field-specific).

Parameters
message Error message.

public void addErrorMessages (Collection<String> incomingMessages)

Append new error messages to those already collected.

Parameters
incomingMessages Collection of error strings.

public void addErrors (Map<StringString> incomingErrors)

Append new field-specific errors to those already collected.

Parameters
incomingErrors of String: String pairs, eg. {"assignee": "Assignee is required"}

public void addReason (ErrorCollection.Reason reason)

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.

Parameters
reason a well known reasons why the function has not been performed.

public void addReasons (Set<ErrorCollection.Reason> reasons)

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.

Parameters
reasons a set of well known reasons why the function has not been performed.

public boolean equals (Object o)

public Collection<String> getErrorMessages ()

Get all non field-specific error messages.

Returns
  • Collection of error Strings.

public Map<StringString> getErrors ()

Get all field-specific errors.

Returns
  • Map of String: String pairs, eg. {"assignee": "Assignee is required"}

public Collection<String> getFlushedErrorMessages ()

Get error messages, then get rid of them.

Returns
  • The (now cleared) error messages.

public Set<ErrorCollection.Reason> getReasons ()

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.

Returns
  • a set of well known reasons why the function has not been performed.

public boolean hasAnyErrors ()

Whether any errors (of any type - field-specific or otherwise) have been collected.

Returns
  • true if any errors (of any type - field-specific or otherwise) have been collected.

public int hashCode ()

public 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.

public void setReasons (Set<ErrorCollection.Reason> reasons)

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.

Parameters
reasons a set of well known reasons why the function has not been performed.

public String toString ()