|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.greenhopper.service.ServiceOutcomeImpl<T>
public class ServiceOutcomeImpl<T>
Generic service outcome that can optionally hold a value.
Constructor Summary | |
---|---|
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. |
Method Summary | ||
---|---|---|
static
|
error(ErrorCollection.Reason reason,
java.lang.String messageKey,
java.lang.Object... params)
Convenience method that returns a new ServiceOutcomeImpl instance containing the provided error message, and no return value. |
|
static
|
error(ServiceOutcome<?> outcome)
Convenience method that returns a new ServiceOutcomeImpl containing the given errors. |
|
static
|
error(java.lang.String contextId,
ErrorCollection.Reason reason,
java.lang.String messageKey,
java.lang.Object... params)
Convenience method that returns a new ServiceOutcomeImpl instance containing the provided contextual error message, and no return value. |
|
static
|
from(ErrorCollection errorCollection)
Convenience method that returns a new ServiceOutcomeImpl containing the given errors. |
|
static
|
from(ErrorCollection errorCollection,
T value)
Convenience method that returns a new ServiceOutcomeImpl containing the given errors and returned value. |
|
ErrorCollection |
getErrors()
|
|
T |
getValue()
Returns the value that was returned by the service, or null. |
|
boolean |
isValid()
|
|
static
|
ok()
Convenience method that returns a new ServiceOutcomeImpl instance containing no errors, and with the provided returned value. |
|
static
|
ok(T returnedValue)
Convenience method that returns a new ServiceOutcomeImpl instance containing no errors, and with the provided returned value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ServiceOutcomeImpl(ErrorCollection errorCollection)
errorCollection
- an ErrorCollectionpublic ServiceOutcomeImpl(ErrorCollection errorCollection, T value)
errorCollection
- an ErrorCollectionvalue
- the wrapped valueMethod Detail |
---|
public static <T> ServiceOutcomeImpl<T> ok(T returnedValue)
T
- the type of the returned valuereturnedValue
- the returned value
public static <Void> ServiceOutcomeImpl<Void> ok()
T
- the type of the returned value
public static <T> ServiceOutcomeImpl<T> error(ErrorCollection.Reason reason, java.lang.String messageKey, java.lang.Object... params)
reason
- the reason for the errormessageKey
- the key of the messageparams
- the parameters to the key
public static <T> ServiceOutcomeImpl<T> error(java.lang.String contextId, ErrorCollection.Reason reason, java.lang.String messageKey, java.lang.Object... params)
contextId
- context of the errorreason
- the reason for the errormessageKey
- the key of the messageparams
- the parameters to the key
public static <T> ServiceOutcomeImpl<T> error(ServiceOutcome<?> outcome)
public static <T> ServiceOutcomeImpl<T> from(ErrorCollection errorCollection)
T
- the type of the returned valueerrorCollection
- an ErrorCollection
public static <T> ServiceOutcomeImpl<T> from(ErrorCollection errorCollection, T value)
T
- the type of the returned valueerrorCollection
- an ErrorCollectionvalue
- the returned value
public boolean isValid()
isValid
in interface ServiceOutcome<T>
public ErrorCollection getErrors()
getErrors
in interface ServiceOutcome<T>
ErrorCollection
that contains any errors that may have happened as a result of the validations.public T getValue()
getValue
in interface ServiceOutcome<T>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |