package io.vertx.reactivex.amqp;
import io.vertx.reactivex.RxHelper;
import io.vertx.reactivex.ObservableHelper;
import io.vertx.reactivex.FlowableHelper;
import io.vertx.reactivex.impl.AsyncResultMaybe;
import io.vertx.reactivex.impl.AsyncResultSingle;
import io.vertx.reactivex.impl.AsyncResultCompletable;
import io.vertx.reactivex.WriteStreamObserver;
import io.vertx.reactivex.WriteStreamSubscriber;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.stream.Collectors;
import io.vertx.core.Handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.lang.rx.RxGen;
import io.vertx.lang.rx.TypeArg;
import io.vertx.lang.rx.MappingIterator;
@RxGen(io.vertx.amqp.AmqpReceiver.class)
public class AmqpReceiver implements io.vertx.reactivex.core.streams.ReadStream<io.vertx.reactivex.amqp.AmqpMessage> {
@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;
AmqpReceiver that = (AmqpReceiver) o;
return delegate.equals(that.delegate);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
public static final TypeArg<AmqpReceiver> __TYPE_ARG = new TypeArg<>( obj -> new AmqpReceiver((io.vertx.amqp.AmqpReceiver) obj),
AmqpReceiver::getDelegate
);
private final io.vertx.amqp.AmqpReceiver delegate;
public AmqpReceiver(io.vertx.amqp.AmqpReceiver delegate) {
this.delegate = delegate;
}
public AmqpReceiver(Object delegate) {
this.delegate = (io.vertx.amqp.AmqpReceiver)delegate;
}
public io.vertx.amqp.AmqpReceiver getDelegate() {
return delegate;
}
private io.reactivex.Observable<io.vertx.reactivex.amqp.AmqpMessage> observable;
private io.reactivex.Flowable<io.vertx.reactivex.amqp.AmqpMessage> flowable;
public synchronized io.reactivex.Observable<io.vertx.reactivex.amqp.AmqpMessage> toObservable() {
if (observable == null) {
Function<io.vertx.amqp.AmqpMessage, io.vertx.reactivex.amqp.AmqpMessage> conv = io.vertx.reactivex.amqp.AmqpMessage::newInstance;
observable = ObservableHelper.toObservable(delegate, conv);
}
return observable;
}
public synchronized io.reactivex.Flowable<io.vertx.reactivex.amqp.AmqpMessage> toFlowable() {
if (flowable == null) {
Function<io.vertx.amqp.AmqpMessage, io.vertx.reactivex.amqp.AmqpMessage> conv = io.vertx.reactivex.amqp.AmqpMessage::newInstance;
flowable = FlowableHelper.toFlowable(delegate, conv);
}
return flowable;
}
private static final TypeArg<io.vertx.reactivex.amqp.AmqpMessage> TYPE_ARG_0 = new TypeArg<io.vertx.reactivex.amqp.AmqpMessage>(o1 -> io.vertx.reactivex.amqp.AmqpMessage.newInstance((io.vertx.amqp.AmqpMessage)o1), o1 -> o1.getDelegate());
public io.vertx.reactivex.core.streams.Pipe<io.vertx.reactivex.amqp.AmqpMessage> pipe() {
io.vertx.reactivex.core.streams.Pipe<io.vertx.reactivex.amqp.AmqpMessage> ret = io.vertx.reactivex.core.streams.Pipe.newInstance((io.vertx.core.streams.Pipe)delegate.pipe(), TYPE_ARG_0);
return ret;
}
public void pipeTo(io.vertx.reactivex.core.streams.WriteStream<io.vertx.reactivex.amqp.AmqpMessage> dst, Handler<AsyncResult<Void>> handler) {
delegate.pipeTo(dst.getDelegate(), handler);
}
public void pipeTo(io.vertx.reactivex.core.streams.WriteStream<io.vertx.reactivex.amqp.AmqpMessage> dst) {
pipeTo(dst, ar -> { });
}
public io.reactivex.Completable rxPipeTo(io.vertx.reactivex.core.streams.WriteStream<io.vertx.reactivex.amqp.AmqpMessage> dst) {
return AsyncResultCompletable.toCompletable($handler -> {
pipeTo(dst, $handler);
});
}
public io.vertx.reactivex.amqp.AmqpReceiver exceptionHandler(Handler<java.lang.Throwable> handler) {
delegate.exceptionHandler(handler);
return this;
}
public io.vertx.reactivex.amqp.AmqpReceiver handler(Handler<io.vertx.reactivex.amqp.AmqpMessage> handler) {
delegate.handler(new Handler<io.vertx.amqp.AmqpMessage>() {
public void handle(io.vertx.amqp.AmqpMessage event) {
handler.handle(io.vertx.reactivex.amqp.AmqpMessage.newInstance((io.vertx.amqp.AmqpMessage)event));
}
});
return this;
}
public io.vertx.reactivex.amqp.AmqpReceiver pause() {
delegate.pause();
return this;
}
public io.vertx.reactivex.amqp.AmqpReceiver resume() {
delegate.resume();
return this;
}
public io.vertx.reactivex.amqp.AmqpReceiver fetch(long amount) {
delegate.fetch(amount);
return this;
}
public io.vertx.reactivex.amqp.AmqpReceiver endHandler(Handler<Void> endHandler) {
delegate.endHandler(endHandler);
return this;
}
public String address() {
if (cached_0 != null) {
return cached_0;
}
String ret = delegate.address();
cached_0 = ret;
return ret;
}
public void close(Handler<AsyncResult<Void>> handler) {
delegate.close(handler);
}
public void close() {
close(ar -> { });
}
public io.reactivex.Completable rxClose() {
return AsyncResultCompletable.toCompletable($handler -> {
close($handler);
});
}
public io.vertx.reactivex.amqp.AmqpConnection connection() {
io.vertx.reactivex.amqp.AmqpConnection ret = io.vertx.reactivex.amqp.AmqpConnection.newInstance((io.vertx.amqp.AmqpConnection)delegate.connection());
return ret;
}
private String cached_0;
public static AmqpReceiver newInstance(io.vertx.amqp.AmqpReceiver arg) {
return arg != null ? new AmqpReceiver(arg) : null;
}
}