public class

ServiceOutcomeImpl

extends ServiceResultImpl
implements ServiceOutcome<T>
java.lang.Object
   ↳ com.atlassian.jira.bc.ServiceResultImpl
     ↳ com.atlassian.jira.bc.ServiceOutcomeImpl<T>

Class Overview

Generic service outcome that can optionally hold a value.

Summary

Public Constructors
ServiceOutcomeImpl(ErrorCollection errorCollection)
Creates a new ServiceOutcomeImpl with the given errors.
ServiceOutcomeImpl(ErrorCollection errorCollection, T value)
Creates a new ServiceOutcomeImpl with the given errors and returned value.
Public Methods
static <T> ServiceOutcomeImpl<T> error(String errorMessage)
Convenience method that returns a new ServiceOutcomeImpl instance containing the provided error message, and no return value.
static <T> ServiceOutcomeImpl<T> error(String errorMessage, ErrorCollection.Reason reason)
Convenience method that returns a new ServiceOutcomeImpl instance containing the provided error message, and no return value.
static <T> ServiceOutcomeImpl<T> error(ServiceOutcome<?> outcome)
Convenience method that returns a new ServiceOutcomeImpl instance with the errors from the passed outcome.
static <T> ServiceOutcomeImpl<T> from(ErrorCollection errorCollection)
Convenience method that returns a new ServiceOutcomeImpl containing the given errors and null return value.
static <T> ServiceOutcomeImpl<T> from(ErrorCollection errorCollection, T value)
Convenience method that returns a new ServiceOutcomeImpl containing the given errors and returned value.
T get()
Returns the value that was returned by the service, or null.
T getReturnedValue()
Returns the value that was returned by the service, or null.
static <T> ServiceOutcomeImpl<T> ok(T returnedValue)
Convenience method that returns a new ServiceOutcomeImpl instance containing no errors, and with the provided returned value.
[Expand]
Inherited Methods
From class com.atlassian.jira.bc.ServiceResultImpl
From class java.lang.Object
From interface com.atlassian.jira.bc.ServiceOutcome
From interface com.atlassian.jira.bc.ServiceResult

Public Constructors

public ServiceOutcomeImpl (ErrorCollection errorCollection)

Creates a new ServiceOutcomeImpl with the given errors. The returned value will be set to null.

Parameters
errorCollection an ErrorCollection

public ServiceOutcomeImpl (ErrorCollection errorCollection, T value)

Creates a new ServiceOutcomeImpl with the given errors and returned value.

Parameters
errorCollection an ErrorCollection
value the wrapped value

Public Methods

public static ServiceOutcomeImpl<T> error (String errorMessage)

Convenience method that returns a new ServiceOutcomeImpl instance containing the provided error message, and no return value.

Parameters
errorMessage the error message to include in the ServiceOutcomeImpl
Returns
  • a new ServiceOutcomeImpl

public static ServiceOutcomeImpl<T> error (String errorMessage, ErrorCollection.Reason reason)

Convenience method that returns a new ServiceOutcomeImpl instance containing the provided error message, and no return value.

Parameters
errorMessage the error message to include in the ServiceOutcomeImpl
reason for the error.
Returns
  • a new ServiceOutcomeImpl

public static ServiceOutcomeImpl<T> error (ServiceOutcome<?> outcome)

Convenience method that returns a new ServiceOutcomeImpl instance with the errors from the passed outcome.

Parameters
outcome the outcome whose errors we are taking.
Returns
  • a new ServiceOutcomeImpl

public static ServiceOutcomeImpl<T> from (ErrorCollection errorCollection)

Convenience method that returns a new ServiceOutcomeImpl containing the given errors and null return value.

Parameters
errorCollection an ErrorCollection
Returns
  • a new ServiceOutcomeImpl instance

public static ServiceOutcomeImpl<T> from (ErrorCollection errorCollection, T value)

Convenience method that returns a new ServiceOutcomeImpl containing the given errors and returned value.

Parameters
errorCollection an ErrorCollection
value the returned value
Returns
  • a new ServiceOutcomeImpl instance

public T get ()

Returns the value that was returned by the service, or null.

Returns
  • the value returned by the service, or null

public T getReturnedValue ()

Returns the value that was returned by the service, or null.

Returns
  • the value returned by the service, or null

public static ServiceOutcomeImpl<T> ok (T returnedValue)

Convenience method that returns a new ServiceOutcomeImpl instance containing no errors, and with the provided returned value.

Parameters
returnedValue the returned value
Returns
  • a new ServiceOutcomeImpl