Package org.apache.flink.util
Class OptionalFailure<T>
- java.lang.Object
-
- org.apache.flink.util.OptionalFailure<T>
-
- All Implemented Interfaces:
Serializable
public class OptionalFailure<T> extends Object implements Serializable
Wrapper around an object representing either a success (with a given value) or a failure cause.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> OptionalFailure<T>createFrom(org.apache.flink.util.function.CheckedSupplier<T> valueSupplier)booleanequals(Object obj)Tget()ThrowablegetFailureCause()TgetUnchecked()inthashCode()booleanisFailure()static <T> OptionalFailure<T>of(T value)static <T> OptionalFailure<T>ofFailure(Throwable failureCause)StringtoString()
-
-
-
Method Detail
-
of
public static <T> OptionalFailure<T> of(T value)
-
ofFailure
public static <T> OptionalFailure<T> ofFailure(Throwable failureCause)
-
createFrom
public static <T> OptionalFailure<T> createFrom(org.apache.flink.util.function.CheckedSupplier<T> valueSupplier)
- Returns:
- wrapped
OptionalFailurereturned byvalueSupplieror wrapped failure ifvalueSupplierhas thrown anException.
-
get
public T get() throws FlinkException
- Returns:
- stored value or throw a
FlinkExceptionwithfailureCause. - Throws:
FlinkException
-
getUnchecked
public T getUnchecked() throws FlinkRuntimeException
- Returns:
- same as
get()but throws aFlinkRuntimeException. - Throws:
FlinkRuntimeException
-
getFailureCause
public Throwable getFailureCause()
-
isFailure
public boolean isFailure()
-
-