Interface ChainFunction<SOURCE_TYPE,TARGET_TYPE>
- Type Parameters:
SOURCE_TYPE- the in-bound type of the functionTARGET_TYPE- the out-bound type of the function
public interface ChainFunction<SOURCE_TYPE,TARGET_TYPE>
extends Function<SOURCE_TYPE,Optional<TARGET_TYPE>>
Represents a function that will delegate its returned
Optional-wrapped value to another ChainFunction if its
own execution returns empty.
This is functional interface whose functional method is Function.apply(Object).
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault ChainFunction<SOURCE_TYPE,TARGET_TYPE> orElse(ChainFunction<SOURCE_TYPE, TARGET_TYPE> orElse) Enablement of the chaining of aChainFunctionby specifying the delegation to another candidate at the orElse phase.
-
Method Details
-
orElse
default ChainFunction<SOURCE_TYPE,TARGET_TYPE> orElse(ChainFunction<SOURCE_TYPE, TARGET_TYPE> orElse) Enablement of the chaining of aChainFunctionby specifying the delegation to another candidate at the orElse phase.- Parameters:
orElse- aChainFunction- Returns:
- the function's result if it succeeds, otherwise the result of the orElse function
-