Interface IUserPortalResponse<T>

  • Type Parameters:
    T - The type of the result.

    public interface IUserPortalResponse<T>
    Represents the result of a user portal API method. The result is always a Future, since the HTTP requests are executed asynchronously. Contains several utility methods to handle the result of the future and to block until the result is available.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      de.xima.fc.api.rest.pub.client.user_portal.OneOfN.Either<T,​UserPortalApiException> get()
      Blocks and synchronously gets the value or the error of the pending future .
      default <R> R match​(Function<? super T,​? extends R> success, Function<? super UserPortalApiException,​? extends R> failure)
      Blocks until the future has arrived and returns the result of applying the given mapper to the present value.
      default T orElse​(T defaultValue)
      Blocks until the future has arrived and returns the present value.
      default T orElseGet​(Function<UserPortalApiException,​T> defaultValue)
      Blocks until the future has arrived and returns the present value.
      default T orElseNull()
      Blocks until the future has arrived and returns the present value.
      default T orElseThrow()
      Blocks until the future has arrived and returns the present value.
    • Method Detail

      • get

        de.xima.fc.api.rest.pub.client.user_portal.OneOfN.Either<T,​UserPortalApiException> get()
        Blocks and synchronously gets the value or the error of the pending future .
        Returns:
        The result of the (pending) future.
      • match

        default <R> R match​(Function<? super T,​? extends R> success,
                            Function<? super UserPortalApiException,​? extends R> failure)
        Blocks until the future has arrived and returns the result of applying the given mapper to the present value.
        Parameters:
        success - The mapper to apply to the present value when successful.
        failure - The mapper to apply to the present value when an error occurred.
        Returns:
        The value of the future or the default value if an error occurred.
      • orElse

        default T orElse​(T defaultValue)
        Blocks until the future has arrived and returns the present value. If an error occurred, returns the default value.
        Parameters:
        defaultValue - The default value to return if an error occurred.
        Returns:
        The value of the future or the default value if an error occurred.
      • orElseGet

        default T orElseGet​(Function<UserPortalApiException,​T> defaultValue)
        Blocks until the future has arrived and returns the present value. If an error occurred, returns the default value.
        Parameters:
        defaultValue - The default value to return if an error occurred.
        Returns:
        The value of the future or the default value if an error occurred.
      • orElseNull

        default T orElseNull()
        Blocks until the future has arrived and returns the present value. If an error occurred, returns null .
        Returns:
        The value of the future or null if an error occurred.
      • orElseThrow

        default T orElseThrow()
                       throws UserPortalApiException
        Blocks until the future has arrived and returns the present value. If an error occurred, throws an exception.
        Returns:
        The value of the future.
        Throws:
        UserPortalApiException - If an error occurred during the API call.