类 LambdaSafe.InvocationResult<R>
- java.lang.Object
- org.springframework.boot.util.LambdaSafe.InvocationResult<R>
- 类型参数:
R
- the result type
- 封闭类:
- LambdaSafe
public static final class LambdaSafe.InvocationResult<R> extends Object
The result of a callback which may be a value,null
or absent entirely if the callback wasn't suitable. Similar in design toOptional
but allows fornull
as a valid value.
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 R
get()
Return the result of the invocation ornull
if the callback wasn't suitable.R
get(R fallback)
Return the result of the invocation or the given fallback if the callback wasn't suitable.boolean
hasResult()
Return true if a result in present.static <R> LambdaSafe.InvocationResult<R>
noResult()
Return anLambdaSafe.InvocationResult
instance representing no result.static <R> LambdaSafe.InvocationResult<R>
of(R value)
Create a newLambdaSafe.InvocationResult
instance with the specified value.
方法详细资料
hasResult
public boolean hasResult()
Return true if a result in present.- 返回:
- if a result is present
get
public R get()
Return the result of the invocation ornull
if the callback wasn't suitable.- 返回:
- the result of the invocation or
null
get
public R get(R fallback)
Return the result of the invocation or the given fallback if the callback wasn't suitable.- 参数:
fallback
- the fallback to use when there is no result- 返回:
- the result of the invocation or the fallback
of
public static <R> LambdaSafe.InvocationResult<R> of(R value)
Create a newLambdaSafe.InvocationResult
instance with the specified value.- 类型参数:
R
- the result type- 参数:
value
- the value (may benull
)- 返回:
- an
LambdaSafe.InvocationResult
noResult
public static <R> LambdaSafe.InvocationResult<R> noResult()
Return anLambdaSafe.InvocationResult
instance representing no result.- 类型参数:
R
- the result type- 返回:
- an
LambdaSafe.InvocationResult