public class Functions extends Object
| Modifier and Type | Method and Description |
|---|---|
static <IN1,IN2> BiConsumerWrapper<IN1,IN2> |
biSink()
Returns a bi-consumer wrapper just discarding the passed inputs.
The returned object will support concatenation and comparison. |
static <IN,OUT> FunctionWrapper<IN,OUT> |
castTo(Class<? extends OUT> type)
Returns a function wrapper casting the passed inputs to the specified class.
The returned object will support concatenation and comparison. |
static <IN,OUT> FunctionWrapper<IN,OUT> |
castTo(ClassToken<? extends OUT> token)
Returns a function wrapper casting the passed inputs to the specified class token type.
The returned object will support concatenation and comparison. |
static <OUT> SupplierWrapper<OUT> |
constant(OUT result)
Returns a supplier wrapper always returning the same result.
The returned object will support concatenation and comparison. |
static <OUT> CommandInvocation<OUT> |
consumerCommand(Consumer<? super ResultChannel<OUT>> consumer)
Builds and returns a new command invocation based on the specified consumer instance.
In order to prevent undesired leaks, the class of the specified consumer must have a static context. |
static <IN,OUT> InvocationFactory<IN,OUT> |
consumerFactory(BiConsumer<? super List<? extends IN>,? super ResultChannel<OUT>> consumer)
Builds and returns a new invocation factory based on the specified bi-consumer instance.
In order to prevent undesired leaks, the class of the specified bi-consumer must have a static context. |
static <IN,OUT> FilterInvocation<IN,OUT> |
consumerFilter(BiConsumer<? super IN,? super ResultChannel<OUT>> consumer)
Builds and returns a new filter invocation based on the specified bi-consumer instance.
In order to prevent undesired leaks, the class of the specified bi-consumer must have a static context. |
static <IN1,IN2> BiFunctionWrapper<IN1,IN2,IN1> |
first()
Returns a bi-function wrapper just returning the first passed argument.
The returned object will support concatenation and comparison. |
static <IN,OUT> InvocationFactory<IN,OUT> |
functionFactory(Function<? super List<? extends IN>,OUT> function)
Builds and returns a new invocation factory based on the specified function instance.
In order to prevent undesired leaks, the class of the specified function must have a static context. |
static <IN,OUT> FilterInvocation<IN,OUT> |
functionFilter(Function<? super IN,OUT> function)
Builds and returns a new filter invocation based on the specified function instance.
In order to prevent undesired leaks, the class of the specified function must have a static context. |
static <IN> FunctionWrapper<IN,IN> |
identity()
Returns the identity function wrapper.
The returned object will support concatenation and comparison. |
static <IN> PredicateWrapper<IN> |
isEqual(Object targetRef)
Returns a predicate wrapper testing for equality to the specified object.
The returned object will support concatenation and comparison. |
static <IN> PredicateWrapper<IN> |
isInstanceOf(Class<?> type)
Returns a predicate wrapper testing whether the passed inputs are instances of the specified
class.
The returned object will support concatenation and comparison. |
static <IN> PredicateWrapper<IN> |
isNull()
Returns a predicate wrapper returning true when the passed argument is null.
The returned object will support concatenation and comparison. |
static <IN> PredicateWrapper<IN> |
isSame(Object targetRef)
Returns a predicate wrapper testing for identity to the specified object.
The returned object will support concatenation and comparison. |
static <IN> PredicateWrapper<IN> |
negative()
Returns a predicate wrapper always returning the false.
The returned object will support concatenation and comparison. |
static <IN> PredicateWrapper<IN> |
notNull()
Returns a predicate wrapper returning true when the passed argument is not null.
The returned object will support concatenation and comparison. |
static OutputConsumerBuilder<Object> |
onComplete(Consumer<Void> consumer)
Returns an output consumer builder employing the specified consumer function to handle the
invocation completion.
|
static OutputConsumerBuilder<Object> |
onError(Consumer<RoutineException> consumer)
Returns an output consumer builder employing the specified consumer function to handle the
invocation errors.
|
static <OUT> OutputConsumerBuilder<OUT> |
onOutput(Consumer<OUT> consumer)
Returns an output consumer builder employing the specified consumer function to handle the
invocation outputs.
|
static <IN> PredicateWrapper<IN> |
positive()
Returns a predicate wrapper always returning the true.
The returned object will support concatenation and comparison. |
static <IN> FilterInvocation<IN,IN> |
predicateFilter(Predicate<? super IN> predicate)
Builds and returns a new filter invocation based on the specified predicate instance.
Only the inputs which satisfies the predicate will be passed on, while the others will be filtered out. In order to prevent undesired leaks, the class of the specified predicate must have a static context. |
static <IN1,IN2> BiFunctionWrapper<IN1,IN2,IN2> |
second()
Returns a bi-function wrapper just returning the second passed argument.
The returned object will support concatenation and comparison. |
static <IN> ConsumerWrapper<IN> |
sink()
Returns a consumer wrapper just discarding the passed inputs.
The returned object will support concatenation and comparison. |
static <OUT> CommandInvocation<OUT> |
supplierCommand(Supplier<OUT> supplier)
Builds and returns a new command invocation based on the specified supplier instance.
In order to prevent undesired leaks, the class of the specified supplier must have a static context. |
static <IN,OUT> InvocationFactory<IN,OUT> |
supplierFactory(Supplier<? extends Invocation<IN,OUT>> supplier)
Builds and returns a new invocation factory based on the specified supplier instance.
In order to prevent undesired leaks, the class of the specified supplier must have a static context. |
static <IN1,IN2> BiConsumerWrapper<IN1,IN2> |
wrapBiConsumer(BiConsumer<IN1,IN2> consumer)
Wraps the specified bi-consumer instance so to provide additional features.
The returned object will support concatenation and comparison. |
static <IN1,IN2,OUT> |
wrapBiFunction(BiFunction<IN1,IN2,OUT> function)
Wraps the specified bi-function instance so to provide additional features.
The returned object will support concatenation and comparison. |
static <IN> ConsumerWrapper<IN> |
wrapConsumer(Consumer<IN> consumer)
Wraps the specified consumer instance so to provide additional features.
The returned object will support concatenation and comparison. |
static <IN,OUT> FunctionWrapper<IN,OUT> |
wrapFunction(Function<IN,OUT> function)
Wraps the specified function instance so to provide additional features.
The returned object will support concatenation and comparison. |
static <IN> PredicateWrapper<IN> |
wrapPredicate(Predicate<IN> predicate)
Wraps the specified predicate instance so to provide additional features.
The returned object will support concatenation and comparison. |
static <OUT> SupplierWrapper<OUT> |
wrapSupplier(Supplier<OUT> supplier)
Wraps the specified supplier instance so to provide additional features.
The returned object will support concatenation and comparison. |
@NotNull public static <IN1,IN2> BiConsumerWrapper<IN1,IN2> biSink()
IN1 - the first input data type.IN2 - the second input data type.@NotNull public static <IN,OUT> FunctionWrapper<IN,OUT> castTo(@NotNull Class<? extends OUT> type)
IN - the input data type.OUT - the output data type.type - the class type.@NotNull public static <IN,OUT> FunctionWrapper<IN,OUT> castTo(@NotNull ClassToken<? extends OUT> token)
IN - the input data type.OUT - the output data type.token - the class token.@NotNull public static <OUT> SupplierWrapper<OUT> constant(OUT result)
OUT - the output data type.result - the result.@NotNull public static <OUT> CommandInvocation<OUT> consumerCommand(@NotNull Consumer<? super ResultChannel<OUT>> consumer)
OUT - the output data type.consumer - the consumer instance.@NotNull public static <IN,OUT> InvocationFactory<IN,OUT> consumerFactory(@NotNull BiConsumer<? super List<? extends IN>,? super ResultChannel<OUT>> consumer)
IN - the input data type.OUT - the output data type.consumer - the bi-consumer instance.@NotNull public static <IN,OUT> FilterInvocation<IN,OUT> consumerFilter(@NotNull BiConsumer<? super IN,? super ResultChannel<OUT>> consumer)
IN - the input data type.OUT - the output data type.consumer - the bi-consumer instance.@NotNull public static <IN1,IN2> BiFunctionWrapper<IN1,IN2,IN1> first()
IN1 - the first input data type.IN2 - the second input data type.@NotNull public static <IN,OUT> InvocationFactory<IN,OUT> functionFactory(@NotNull Function<? super List<? extends IN>,OUT> function)
IN - the input data type.OUT - the output data type.function - the function instance.@NotNull public static <IN,OUT> FilterInvocation<IN,OUT> functionFilter(@NotNull Function<? super IN,OUT> function)
IN - the input data type.OUT - the output data type.function - the function instance.@NotNull public static <IN> FunctionWrapper<IN,IN> identity()
IN - the input data type.@NotNull public static <IN> PredicateWrapper<IN> isEqual(@Nullable Object targetRef)
IN - the input data type.targetRef - the target reference.@NotNull public static <IN> PredicateWrapper<IN> isInstanceOf(@NotNull Class<?> type)
IN - the input data type.type - the class type.@NotNull public static <IN> PredicateWrapper<IN> isNull()
IN - the input data type.@NotNull public static <IN> PredicateWrapper<IN> isSame(@Nullable Object targetRef)
IN - the input data type.targetRef - the target reference.@NotNull public static <IN> PredicateWrapper<IN> negative()
IN - the input data type.@NotNull public static <IN> PredicateWrapper<IN> notNull()
IN - the input data type.@NotNull public static OutputConsumerBuilder<Object> onComplete(@NotNull Consumer<Void> consumer)
consumer - the consumer function.@NotNull public static OutputConsumerBuilder<Object> onError(@NotNull Consumer<RoutineException> consumer)
consumer - the consumer function.@NotNull public static <OUT> OutputConsumerBuilder<OUT> onOutput(@NotNull Consumer<OUT> consumer)
OUT - the output data type.consumer - the consumer function.@NotNull public static <IN> PredicateWrapper<IN> positive()
IN - the input data type.@NotNull public static <IN> FilterInvocation<IN,IN> predicateFilter(@NotNull Predicate<? super IN> predicate)
IN - the input data type.predicate - the predicate instance.@NotNull public static <IN1,IN2> BiFunctionWrapper<IN1,IN2,IN2> second()
IN1 - the first input data type.IN2 - the second input data type.@NotNull public static <IN> ConsumerWrapper<IN> sink()
IN - the input data type.@NotNull public static <OUT> CommandInvocation<OUT> supplierCommand(@NotNull Supplier<OUT> supplier)
OUT - the output data type.supplier - the supplier instance.@NotNull public static <IN,OUT> InvocationFactory<IN,OUT> supplierFactory(@NotNull Supplier<? extends Invocation<IN,OUT>> supplier)
IN - the input data type.OUT - the output data type.supplier - the supplier instance.@NotNull public static <IN1,IN2> BiConsumerWrapper<IN1,IN2> wrapBiConsumer(@NotNull BiConsumer<IN1,IN2> consumer)
IN1 - the first input data type.IN2 - the second input data type.consumer - the bi-consumer instance.@NotNull public static <IN1,IN2,OUT> BiFunctionWrapper<IN1,IN2,OUT> wrapBiFunction(@NotNull BiFunction<IN1,IN2,OUT> function)
IN1 - the first input data type.IN2 - the second input data type.OUT - the output data type.function - the bi-function instance.@NotNull public static <IN> ConsumerWrapper<IN> wrapConsumer(@NotNull Consumer<IN> consumer)
IN - the input data type.consumer - the consumer instance.@NotNull public static <IN,OUT> FunctionWrapper<IN,OUT> wrapFunction(@NotNull Function<IN,OUT> function)
IN - the input data type.OUT - the output data type.function - the function instance.@NotNull public static <IN> PredicateWrapper<IN> wrapPredicate(@NotNull Predicate<IN> predicate)
IN - the input data type.predicate - the predicate instance.@NotNull public static <OUT> SupplierWrapper<OUT> wrapSupplier(@NotNull Supplier<OUT> supplier)
OUT - the output data type.supplier - the supplier instance.