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
Modifier and TypeMethodDescriptionget()Blocks and synchronously gets the value or the error of the pending future .default <R> Rmatch(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 TBlocks until the future has arrived and returns the present value.default TorElseGet(Function<UserPortalApiException, T> defaultValue) Blocks until the future has arrived and returns the present value.default TBlocks until the future has arrived and returns the present value.default TBlocks until the future has arrived and returns the present value.
-
Method Details
-
get
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
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
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
Blocks until the future has arrived and returns the present value. If an error occurred, returnsnull.- Returns:
- The value of the future or
nullif an error occurred.
-
orElseThrow
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.
-