All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.julienviet.reactivex.pgclient.PgStream Maven / Gradle / Ivy

/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package com.julienviet.reactivex.pgclient;

import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.Completable;
import io.reactivex.Maybe;
import io.vertx.reactivex.core.streams.ReadStream;
import io.vertx.core.Handler;


@io.vertx.lang.reactivex.RxGen(com.julienviet.pgclient.PgStream.class)
public class PgStream implements ReadStream {

  @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 static final io.vertx.lang.reactivex.TypeArg __TYPE_ARG = new io.vertx.lang.reactivex.TypeArg<>(
    obj -> new PgStream((com.julienviet.pgclient.PgStream) obj),
    PgStream::getDelegate
  );

  private final com.julienviet.pgclient.PgStream delegate;
  public final io.vertx.lang.reactivex.TypeArg __typeArg_0;
  
  public PgStream(com.julienviet.pgclient.PgStream delegate) {
    this.delegate = delegate;
    this.__typeArg_0 = io.vertx.lang.reactivex.TypeArg.unknown();
  }

  public PgStream(com.julienviet.pgclient.PgStream delegate, io.vertx.lang.reactivex.TypeArg typeArg_0) {
    this.delegate = delegate;
    this.__typeArg_0 = typeArg_0;
  }

  public com.julienviet.pgclient.PgStream getDelegate() {
    return delegate;
  }

  private io.reactivex.Observable observable;
  private io.reactivex.Flowable flowable;

  public synchronized io.reactivex.Observable toObservable() {
    if (observable == null) {
      java.util.function.Function conv = (java.util.function.Function) __typeArg_0.wrap;
      observable = io.vertx.reactivex.ObservableHelper.toObservable(delegate, conv);
    }
    return observable;
  }

  public synchronized io.reactivex.Flowable toFlowable() {
    if (flowable == null) {
      java.util.function.Function conv = (java.util.function.Function) __typeArg_0.wrap;
      flowable = io.vertx.reactivex.FlowableHelper.toFlowable(delegate, conv);
    }
    return flowable;
  }

  public PgStream exceptionHandler(Handler handler) { 
    delegate.exceptionHandler(handler);
    return this;
  }

  public PgStream handler(Handler handler) { 
    delegate.handler(new Handler() {
      public void handle(T event) {
        handler.handle((T)__typeArg_0.wrap(event));
      }
    });
    return this;
  }

  public PgStream pause() { 
    delegate.pause();
    return this;
  }

  public PgStream resume() { 
    delegate.resume();
    return this;
  }

  public PgStream endHandler(Handler endHandler) { 
    delegate.endHandler(endHandler);
    return this;
  }


  public static PgStream newInstance(com.julienviet.pgclient.PgStream arg) {
    return arg != null ? new PgStream(arg) : null;
  }

  public static PgStream newInstance(com.julienviet.pgclient.PgStream arg, io.vertx.lang.reactivex.TypeArg __typeArg_T) {
    return arg != null ? new PgStream(arg, __typeArg_T) : null;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy