io.vertx.up.unity.Functions Maven / Gradle / Ivy
package io.vertx.up.unity;
import io.vertx.core.Future;
import io.vertx.core.json.JsonArray;
import io.vertx.up.fn.Fn;
import io.vertx.up.uca.container.Refer;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Supplier;
class Functions {
@SuppressWarnings("all")
static BiConsumer fnCollectJArray() {
return (collection, item) -> collection.add(item);
}
static Future fnSupplier(final Refer container, final E entity, final Supplier supplier) {
return Fn.getNull(Future.succeededFuture(), () -> {
if (null == supplier) {
container.add(entity);
} else {
container.add(supplier.get());
}
return Future.succeededFuture(entity);
}, container, entity);
}
static Future fnConsumer(final Refer container, final E entity, final Consumer consumer) {
return Fn.getNull(Future.succeededFuture(), () -> {
consumer.accept(container.get());
return Future.succeededFuture(entity);
}, container, entity, consumer);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy