@ExperimentalApi public class

ErrorCollections

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

@ExperimentalApi

This class is considered usable by external developers but its contracts have not stabilized.

Experimental APIs may be changed at any time before being marked @Internal or @PublicApi.

Class Overview

Static factory methods for creating simple ErrorCollection instances.

All instances returned by methods in this class are Serializable.

Summary

Public Constructors
ErrorCollections()
Public Methods
static ErrorCollection copyOf(ErrorCollection errorCollection)
Creates a new error collection with contents copied from the supplied argument.
static ErrorCollection create(String errorMessage, ErrorCollection.Reason reason)
Creates a new instance of error collection that contains the specified message and reason.
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.
static ErrorCollection empty()
Creates a new instance of empty error collection.
static ErrorCollection join(ErrorCollection... errorCollections)
Creates an error collection containing all errors from given error collections
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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ErrorCollections ()

Public Methods

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

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

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

public static ErrorCollection empty ()

Creates a new instance of empty error collection.

Returns
  • empty error collection

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

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

Parameters
field field that failed validation
message detailed error message
Returns