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

io.knotx.reactivex.proxy.KnotProxy Maven / Gradle / Ivy

Go to download

Core Knot.x module consisting of Server, Repositories, Splitter, Assembler and Gateway.

There is a newer version: 1.6.0
Show newest version
/*
 * 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 io.knotx.reactivex.proxy;

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.core.eventbus.DeliveryOptions;
import io.knotx.dataobjects.KnotContext;
import io.vertx.reactivex.core.Vertx;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;


@io.vertx.lang.reactivex.RxGen(io.knotx.proxy.KnotProxy.class)
public class KnotProxy {

  @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;
    KnotProxy that = (KnotProxy) 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 KnotProxy((io.knotx.proxy.KnotProxy) obj),
    KnotProxy::getDelegate
  );

  private final io.knotx.proxy.KnotProxy delegate;
  
  public KnotProxy(io.knotx.proxy.KnotProxy delegate) {
    this.delegate = delegate;
  }

  public io.knotx.proxy.KnotProxy getDelegate() {
    return delegate;
  }

  public static KnotProxy createProxy(Vertx vertx, String address) { 
    KnotProxy ret = KnotProxy.newInstance(io.knotx.proxy.KnotProxy.createProxy(vertx.getDelegate(), address));
    return ret;
  }

  public static KnotProxy createProxyWithOptions(Vertx vertx, String address, DeliveryOptions deliveryOptions) { 
    KnotProxy ret = KnotProxy.newInstance(io.knotx.proxy.KnotProxy.createProxyWithOptions(vertx.getDelegate(), address, deliveryOptions));
    return ret;
  }

  public void process(KnotContext knotContext, Handler> result) { 
    delegate.process(knotContext, result);
  }

  public Single rxProcess(KnotContext knotContext) { 
    return new io.vertx.reactivex.core.impl.AsyncResultSingle(handler -> {
      process(knotContext, handler);
    });
  }


  public static  KnotProxy newInstance(io.knotx.proxy.KnotProxy arg) {
    return arg != null ? new KnotProxy(arg) : null;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy