public class ServiceOutcomeImpl<T> extends ServiceResultImpl implements ServiceOutcome<T>
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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> |
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> |
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.
|
getErrorCollection, getWarningCollection, isValid
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fold
getErrorCollection, getWarningCollection, hasWarnings, isValid
public ServiceOutcomeImpl(ErrorCollection errorCollection)
errorCollection
- an ErrorCollectionpublic ServiceOutcomeImpl(ErrorCollection errorCollection, T value)
errorCollection
- an ErrorCollectionvalue
- the wrapped valuepublic static <T> ServiceOutcomeImpl<T> ok(T returnedValue)
T
- the type of the returned valuereturnedValue
- the returned valuepublic static <T> ServiceOutcomeImpl<T> error(ServiceOutcome<?> outcome)
T
- the type of the returned valueoutcome
- the outcome whose errors we are taking.public static <T> ServiceOutcomeImpl<T> error(String errorMessage)
T
- the type of the returned valueerrorMessage
- the error message to include in the ServiceOutcomeImplpublic static <T> ServiceOutcomeImpl<T> error(String errorMessage, ErrorCollection.Reason reason)
T
- the type of the returned valuereason
- for the error.errorMessage
- the error message to include in the ServiceOutcomeImplpublic static <T> ServiceOutcomeImpl<T> from(ErrorCollection errorCollection, T value)
T
- the type of the returned valueerrorCollection
- an ErrorCollectionvalue
- the returned valuepublic static <T> ServiceOutcomeImpl<T> from(ErrorCollection errorCollection)
T
- the type of the returned valueerrorCollection
- an ErrorCollectionpublic T getReturnedValue()
getReturnedValue
in interface ServiceOutcome<T>
public T get()
get
in interface ServiceOutcome<T>
Copyright © 2002-2019 Atlassian. All Rights Reserved.