public final class ProviderOutcome
extends java.lang.Object
UseProvider
.Modifier and Type | Method and Description |
---|---|
static ProviderOutcome |
failure()
Create a failed outcome without a specific
cause . |
static ProviderOutcome |
failure(java.lang.Throwable cause)
Create a failed outcome with the given
cause . |
java.lang.Throwable |
getCause()
Returns the cause for this failure outcome or
null if this outcome is a success or no cause has been defined with the
failure(Throwable) method. |
java.lang.Object |
getResult()
Get the result in this outcome.
|
boolean |
isFailure()
Check whether the outcome is a failure
|
boolean |
isSuccess()
Check if the outcome has been successful
|
static ProviderOutcome |
notNullOrFailure(java.lang.Object obj)
If the given obj is not
null return a successful outcome , with the given result. |
static ProviderOutcome |
success(java.lang.Object result)
Create a successful outcome
|
public static ProviderOutcome success(java.lang.Object result)
result
- the resultpublic static ProviderOutcome failure()
cause
. This method must be used for creating outcomes that don't
signal an error but rather the fact that the UseProvider
is not capable of fulfilling the request.public static ProviderOutcome failure(java.lang.Throwable cause)
cause
. This method must be used when the UseProvider
is
capable of fulfilling the request but an error condition prevents the provider from doing so.cause
- The reason for this failure, which may be null
public static ProviderOutcome notNullOrFailure(java.lang.Object obj)
null
return a successful outcome
, with the given result. Otherwise, return
failure()
.obj
- the resultpublic boolean isSuccess()
public boolean isFailure()
public java.lang.Object getResult()
java.lang.IllegalStateException
- if the outcome is a failurepublic java.lang.Throwable getCause()
null
if this outcome is a success or no cause has been defined with the
failure(Throwable)
method.Copyright © 2018 The Apache Software Foundation. All rights reserved.