DATATYPE - The callable result type.PARAMTYPE - The parameter typeEXTYPE - Exception type to be thrown@Immutable public class AdapterThrowingRunnableToCallableWithParameter<DATATYPE,PARAMTYPE,EXTYPE extends Exception> extends Object implements IThrowingCallableWithParameter<DATATYPE,PARAMTYPE,EXTYPE>
IThrowingRunnable into an
IThrowingCallable.| Constructor and Description |
|---|
AdapterThrowingRunnableToCallableWithParameter(IThrowingRunnableWithParameter<PARAMTYPE,EXTYPE> aRunnable) |
AdapterThrowingRunnableToCallableWithParameter(IThrowingRunnableWithParameter<PARAMTYPE,EXTYPE> aRunnable,
DATATYPE aResult) |
| Modifier and Type | Method and Description |
|---|---|
DATATYPE |
call(PARAMTYPE aParam)
The call back method to be called.
|
static <PARAMTYPE,EXTYPE extends Exception> |
createAdapter(IThrowingRunnableWithParameter<PARAMTYPE,EXTYPE> aRunnable)
Create a callable that always returns
null. |
static <DATATYPE,PARAMTYPE,EXTYPE extends Exception> |
createAdapter(IThrowingRunnableWithParameter<PARAMTYPE,EXTYPE> aRunnable,
DATATYPE aResult)
Create a callable that always returns the passed value.
|
DATATYPE |
getResult() |
IThrowingRunnableWithParameter<PARAMTYPE,EXTYPE> |
getRunnable() |
String |
toString() |
public AdapterThrowingRunnableToCallableWithParameter(@Nonnull IThrowingRunnableWithParameter<PARAMTYPE,EXTYPE> aRunnable)
@Nonnull public IThrowingRunnableWithParameter<PARAMTYPE,EXTYPE> getRunnable()
@Nullable public DATATYPE call(PARAMTYPE aParam) throws EXTYPE extends Exception
IThrowingCallableWithParametercall in interface IThrowingCallableWithParameter<DATATYPE,PARAMTYPE,EXTYPE extends Exception>aParam - The parameter to be passed in. May be null or non-
null depending on the implementation.null or non- null
depending on the implementation.EXTYPE - in case something goes wrongEXTYPE extends Exception@Nonnull public static <PARAMTYPE,EXTYPE extends Exception> AdapterThrowingRunnableToCallableWithParameter<Object,PARAMTYPE,EXTYPE> createAdapter(@Nonnull IThrowingRunnableWithParameter<PARAMTYPE,EXTYPE> aRunnable)
null.PARAMTYPE - The parameter type.EXTYPE - Exception type to be thrownaRunnable - The runnable to be executed.AdapterThrowingRunnableToCallableWithParameter
object.@Nonnull public static <DATATYPE,PARAMTYPE,EXTYPE extends Exception> AdapterThrowingRunnableToCallableWithParameter<DATATYPE,PARAMTYPE,EXTYPE> createAdapter(@Nonnull IThrowingRunnableWithParameter<PARAMTYPE,EXTYPE> aRunnable, @Nullable DATATYPE aResult)
DATATYPE - The callable result type.PARAMTYPE - The parameter type.EXTYPE - Exception type to be thrownaRunnable - The runnable to be executed.aResult - The expected result from calling IThrowingCallable.call() .
May be null.AdapterThrowingRunnableToCallableWithParameter
object.Copyright © 2014–2015 Philip Helger. All rights reserved.