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

@PublicApi public interface ServiceOutcome<T> extends ServiceResult
A service result that has a value.
Since:
v4.2
  • 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 by ServiceResult.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 when ServiceResult.isValid() returns true
      onFailure - the function to apply when ServiceResult.isValid() returns false
      Returns:
      see above
      Since:
      7.1