Package com.atlassian.jira.bc
Interface ServiceOutcome<T>
- All Superinterfaces:
ServiceResult
- All Known Implementing Classes:
ArchivedProjectService.ArchivingResult
,ArchivedProjectService.ValidationResult
,DefaultProjectService.PermissionErrorResult
,DefaultProjectService.ProjectNotFoundResult
,ProjectService.AbstractProjectResult
,ProjectService.DeleteProjectValidationResult
,ProjectService.GetProjectResult
,ServiceOutcomeImpl
,ServiceOutcomeWithWarnings
A service result that has a value.
- Since:
- v4.2
-
Method Summary
Modifier and TypeMethodDescriptiondefault <R> R
fold
(Function<? super T, R> onSuccess, Function<? super ErrorCollection, R> onFailure) Folds this outcome into a value using the given functions.get()
Returns the value that was returned by the service, or null.Returns the value that was returned by the service, or null.Methods inherited from interface com.atlassian.jira.bc.ServiceResult
getErrorCollection, getWarningCollection, hasWarnings, isValid
-
Method Details
-
getReturnedValue
T getReturnedValue()Returns the value that was returned by the service, or null.- Returns:
- the value returned by the service, or null
-
get
T get()Returns the value that was returned by the service, or null.- Returns:
- the value returned by the service, or null
- Since:
- 6.2
-
fold
default <R> R fold(@Nonnull Function<? super T, R> onSuccess, @Nonnull Function<? super ErrorCollection, R> onFailure) Folds this outcome into a value using the given functions. Note that this method does not provide access to any warnings returned byServiceResult.getWarningCollection()
. If your use case requires you to process warnings, use the other methods in this interface.- Type Parameters:
R
- the return type- Parameters:
onSuccess
- the function to apply whenServiceResult.isValid()
returns trueonFailure
- the function to apply whenServiceResult.isValid()
returns false- Returns:
- see above
- Since:
- 7.1
-