Class JavaUtils
java.lang.Object
org.springframework.integration.JavaUtils
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription<T1,T2> JavaUtils acceptIfCondition(boolean condition, @Nullable T1 t1, @Nullable T2 t2, BiConsumer<T1, T2> consumer) InvokeBiConsumer.accept(Object, Object)with the arguments if the condition is true.<T> JavaUtilsacceptIfCondition(boolean condition, @Nullable T value, Consumer<T> consumer) InvokeConsumer.accept(Object)with the value if the condition is true.acceptIfHasText(@Nullable String value, Consumer<String> consumer) InvokeConsumer.accept(Object)with the value if it is not null or empty.<T> JavaUtilsacceptIfHasText(T t1, @Nullable String value, BiConsumer<T, String> consumer) InvokeBiConsumer.accept(Object, Object)with the arguments if the value argument is not null or empty.<T> JavaUtilsacceptIfNotEmpty(@Nullable T @Nullable [] value, Consumer<T[]> consumer) InvokeConsumer.accept(Object)with the value if it is not null or empty.<T> JavaUtilsacceptIfNotEmpty(@Nullable List<T> value, Consumer<List<T>> consumer) InvokeConsumer.accept(Object)with the value if it is not null or empty.<T> JavaUtilsacceptIfNotNull(@Nullable T value, Consumer<T> consumer) InvokeConsumer.accept(Object)with the value if it is not null.<T1,T2> JavaUtils acceptIfNotNull(T1 t1, @Nullable T2 t2, BiConsumer<T1, T2> consumer) InvokeBiConsumer.accept(Object, Object)with the arguments if the t2 argument is not null.
-
Field Details
-
INSTANCE
The singleton instance of this utility class.
-
-
Method Details
-
acceptIfCondition
InvokeConsumer.accept(Object)with the value if the condition is true.- Type Parameters:
T- the value type.- Parameters:
condition- the condition.value- the value.consumer- the consumer.- Returns:
- this.
-
acceptIfNotNull
InvokeConsumer.accept(Object)with the value if it is not null.- Type Parameters:
T- the value type.- Parameters:
value- the value.consumer- the consumer.- Returns:
- this.
-
acceptIfHasText
InvokeConsumer.accept(Object)with the value if it is not null or empty.- Parameters:
value- the value.consumer- the consumer.- Returns:
- this.
- Since:
- 5.2
-
acceptIfNotEmpty
InvokeConsumer.accept(Object)with the value if it is not null or empty.- Type Parameters:
T- the value type.- Parameters:
value- the value.consumer- the consumer.- Returns:
- this.
- Since:
- 5.2
-
acceptIfNotEmpty
InvokeConsumer.accept(Object)with the value if it is not null or empty.- Type Parameters:
T- the value type.- Parameters:
value- the value.consumer- the consumer.- Returns:
- this.
- Since:
- 5.2
-
acceptIfCondition
public <T1,T2> JavaUtils acceptIfCondition(boolean condition, @Nullable T1 t1, @Nullable T2 t2, BiConsumer<T1, T2> consumer) InvokeBiConsumer.accept(Object, Object)with the arguments if the condition is true.- Type Parameters:
T1- the first argument type.T2- the second argument type.- Parameters:
condition- the condition.t1- the first consumer argumentt2- the second consumer argumentconsumer- the consumer.- Returns:
- this.
- Since:
- 5.2
-
acceptIfNotNull
InvokeBiConsumer.accept(Object, Object)with the arguments if the t2 argument is not null.- Type Parameters:
T1- the first argument type.T2- the second argument type.- Parameters:
t1- the first argumentt2- the second consumer argumentconsumer- the consumer.- Returns:
- this.
- Since:
- 5.2
-
acceptIfHasText
InvokeBiConsumer.accept(Object, Object)with the arguments if the value argument is not null or empty.- Type Parameters:
T- the first argument type.- Parameters:
t1- the first consumer argument.value- the second consumer argumentconsumer- the consumer.- Returns:
- this.
- Since:
- 5.2
-