io.reactiverse.mutiny.pgclient.PgStream Maven / Gradle / Ivy
package io.reactiverse.mutiny.pgclient;
import java.util.Map;
import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.Uni;
import java.util.function.Consumer;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Publisher;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
/**
* A row oriented stream.
*
*
* NOTE: This class has been automatically generated from the {@link io.reactiverse.pgclient.PgStream original} non Mutiny-ified interface using Vert.x codegen.
*/
@io.smallrye.mutiny.vertx.MutinyGen(io.reactiverse.pgclient.PgStream.class)
public class PgStream implements io.vertx.mutiny.core.streams.ReadStream {
public static final io.smallrye.mutiny.vertx.TypeArg __TYPE_ARG = new io.smallrye.mutiny.vertx.TypeArg<>( obj -> new PgStream((io.reactiverse.pgclient.PgStream) obj),
PgStream::getDelegate
);
private final io.reactiverse.pgclient.PgStream delegate;
public final io.smallrye.mutiny.vertx.TypeArg __typeArg_0;
public PgStream(io.reactiverse.pgclient.PgStream delegate) {
this.delegate = delegate;
this.__typeArg_0 = io.smallrye.mutiny.vertx.TypeArg.unknown(); }
public PgStream(io.reactiverse.pgclient.PgStream delegate, io.smallrye.mutiny.vertx.TypeArg typeArg_0) {
this.delegate = delegate;
this.__typeArg_0 = typeArg_0;
}
/**
* Empty constructor used by CDI, do not use this constructor directly.
**/
PgStream() { this.delegate = null;
this.__typeArg_0 = io.smallrye.mutiny.vertx.TypeArg.unknown(); }
public io.reactiverse.pgclient.PgStream getDelegate() {
return delegate;
}
@Override
public String toString() {
return delegate.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PgStream that = (PgStream) o;
return delegate.equals(that.delegate);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
public io.vertx.mutiny.core.streams.ReadStream fetch(long arg0) {
delegate.fetch(arg0);
return this;
}
public io.vertx.mutiny.core.streams.Pipe pipe() {
io.vertx.mutiny.core.streams.Pipe ret = io.vertx.mutiny.core.streams.Pipe.newInstance(delegate.pipe(), __typeArg_0);
return ret;
}
private void __pipeTo(io.vertx.mutiny.core.streams.WriteStream dst, Handler> handler) {
delegate.pipeTo(dst.getDelegate(), handler);
}
public Uni pipeTo(io.vertx.mutiny.core.streams.WriteStream dst) {
return io.smallrye.mutiny.vertx.AsyncResultUni.toUni(handler -> {
__pipeTo(dst, handler);
});
}
public Void pipeToAndAwait(io.vertx.mutiny.core.streams.WriteStream dst) {
return (Void) pipeTo(dst).await().indefinitely();
}
private io.reactiverse.mutiny.pgclient.PgStream __exceptionHandler(Handler handler) {
delegate.exceptionHandler(handler);
return this;
}
public io.reactiverse.mutiny.pgclient.PgStream exceptionHandler(Consumer handler) {
return __exceptionHandler(handler != null ? handler::accept : null);
}
private io.reactiverse.mutiny.pgclient.PgStream __handler(Handler handler) {
delegate.handler(new Handler() {
public void handle(T event) {
handler.handle((T)__typeArg_0.wrap(event));
}
});
return this;
}
public io.reactiverse.mutiny.pgclient.PgStream handler(Consumer handler) {
return __handler(handler != null ? handler::accept : null);
}
public io.reactiverse.mutiny.pgclient.PgStream pause() {
delegate.pause();
return this;
}
public io.reactiverse.mutiny.pgclient.PgStream resume() {
delegate.resume();
return this;
}
private io.reactiverse.mutiny.pgclient.PgStream __endHandler(Handler endHandler) {
delegate.endHandler(endHandler);
return this;
}
public io.reactiverse.mutiny.pgclient.PgStream endHandler(Consumer endHandler) {
return __endHandler(endHandler != null ? endHandler::accept : null);
}
/**
* Close the stream and release the resources.
* @param completionHandler the completion handler for this operation
*/
private void __close(Handler> completionHandler) {
delegate.close(completionHandler);
}
/**
* Close the stream and release the resources.
* @return
*/
public Uni close() {
return io.smallrye.mutiny.vertx.AsyncResultUni.toUni(handler -> {
__close(handler);
});
}
/**
* Close the stream and release the resources.
* @return
*/
public Void closeAndAwait() {
return (Void) close().await().indefinitely();
}
private Multi multi;
public synchronized Multi toMulti() {
if (multi == null) {
java.util.function.Function conv = (java.util.function.Function) __typeArg_0.wrap;
multi = io.smallrye.mutiny.vertx.MultiHelper.toMulti(delegate, conv); }
return multi;
}
public java.lang.Iterable toBlockingIterable() {
return toMulti().subscribe().asIterable(); }
public java.util.stream.Stream toBlockingStream() {
return toMulti().subscribe().asStream(); }
public static PgStream newInstance(io.reactiverse.pgclient.PgStream arg) {
return arg != null ? new PgStream(arg) : null;
}
public static PgStream newInstance(io.reactiverse.pgclient.PgStream arg, io.smallrye.mutiny.vertx.TypeArg __typeArg_T) {
return arg != null ? new PgStream(arg, __typeArg_T) : null;
}
}