io.vertx.rxjava.oracleclient.OracleConnection 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 io.vertx.rxjava.oracleclient;
import rx.Observable;
import rx.Single;
import io.vertx.rx.java.RxHelper;
import io.vertx.rx.java.WriteStreamSubscriber;
import io.vertx.rx.java.SingleOnSubscribeAdapter;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.function.Supplier;
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;
/**
* A connection to Oracle Database.
*
*
* NOTE: This class has been automatically generated from the {@link io.vertx.oracleclient.OracleConnection original} non RX-ified interface using Vert.x codegen.
*/
@RxGen(io.vertx.oracleclient.OracleConnection.class)
public class OracleConnection extends io.vertx.rxjava.sqlclient.SqlConnection {
@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;
OracleConnection that = (OracleConnection) o;
return delegate.equals(that.delegate);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
public static final TypeArg __TYPE_ARG = new TypeArg<>( obj -> new OracleConnection((io.vertx.oracleclient.OracleConnection) obj),
OracleConnection::getDelegate
);
private final io.vertx.oracleclient.OracleConnection delegate;
public OracleConnection(io.vertx.oracleclient.OracleConnection delegate) {
super(delegate);
this.delegate = delegate;
}
public OracleConnection(Object delegate) {
super((io.vertx.oracleclient.OracleConnection)delegate);
this.delegate = (io.vertx.oracleclient.OracleConnection)delegate;
}
public io.vertx.oracleclient.OracleConnection getDelegate() {
return delegate;
}
private static final TypeArg TYPE_ARG_0 = new TypeArg(o1 -> io.vertx.rxjava.oracleclient.OracleConnection.newInstance((io.vertx.oracleclient.OracleConnection)o1), o1 -> o1.getDelegate());
private static final TypeArg TYPE_ARG_1 = new TypeArg(o1 -> io.vertx.rxjava.oracleclient.OracleConnection.newInstance((io.vertx.oracleclient.OracleConnection)o1), o1 -> o1.getDelegate());
/**
* Create a connection to Oracle with the given connectOptions
.
* @param vertx the vertx instance
* @param connectOptions the options for the connection
* @return a future notified with with the connection or the failure
*/
public static io.vertx.core.Future connect(io.vertx.rxjava.core.Vertx vertx, io.vertx.oracleclient.OracleConnectOptions connectOptions) {
io.vertx.core.Future ret = io.vertx.oracleclient.OracleConnection.connect(vertx.getDelegate(), connectOptions).map(val -> io.vertx.rxjava.oracleclient.OracleConnection.newInstance((io.vertx.oracleclient.OracleConnection)val));
return ret;
}
/**
* Create a connection to Oracle with the given connectOptions
.
* @param vertx the vertx instance
* @param connectOptions the options for the connection
* @return a future notified with with the connection or the failure
*/
public static rx.Single rxConnect(io.vertx.rxjava.core.Vertx vertx, io.vertx.oracleclient.OracleConnectOptions connectOptions) {
return Single.create(new SingleOnSubscribeAdapter<>(fut -> {
io.vertx.rxjava.oracleclient.OracleConnection.connect(vertx, connectOptions).onComplete(fut);
}));
}
/**
* Like {@link io.vertx.rxjava.oracleclient.OracleConnection#connect} with options built from connectionUri
.
* @param vertx
* @param connectionUri
* @return
*/
public static io.vertx.core.Future connect(io.vertx.rxjava.core.Vertx vertx, java.lang.String connectionUri) {
io.vertx.core.Future ret = io.vertx.oracleclient.OracleConnection.connect(vertx.getDelegate(), connectionUri).map(val -> io.vertx.rxjava.oracleclient.OracleConnection.newInstance((io.vertx.oracleclient.OracleConnection)val));
return ret;
}
/**
* Like {@link io.vertx.rxjava.oracleclient.OracleConnection#connect} with options built from connectionUri
.
* @param vertx
* @param connectionUri
* @return
*/
public static rx.Single rxConnect(io.vertx.rxjava.core.Vertx vertx, java.lang.String connectionUri) {
return Single.create(new SingleOnSubscribeAdapter<>(fut -> {
io.vertx.rxjava.oracleclient.OracleConnection.connect(vertx, connectionUri).onComplete(fut);
}));
}
/**
*
* @param handler
* @return
*/
public io.vertx.rxjava.oracleclient.OracleConnection exceptionHandler(io.vertx.core.Handler handler) {
delegate.exceptionHandler(handler);
return this;
}
/**
*
* @param handler
* @return
*/
public io.vertx.rxjava.oracleclient.OracleConnection closeHandler(io.vertx.core.Handler handler) {
delegate.closeHandler(handler);
return this;
}
/**
* Cast a to {@link io.vertx.rxjava.oracleclient.OracleConnection}.
*
* This is mostly useful for Vert.x generated APIs like RxJava/Mutiny.
* @param sqlConnection the connection to cast
* @return a {@link io.vertx.rxjava.oracleclient.OracleConnection instance}
*/
public static io.vertx.rxjava.oracleclient.OracleConnection cast(io.vertx.rxjava.sqlclient.SqlConnection sqlConnection) {
io.vertx.rxjava.oracleclient.OracleConnection ret = io.vertx.rxjava.oracleclient.OracleConnection.newInstance((io.vertx.oracleclient.OracleConnection)io.vertx.oracleclient.OracleConnection.cast(sqlConnection.getDelegate()));
return ret;
}
public static OracleConnection newInstance(io.vertx.oracleclient.OracleConnection arg) {
return arg != null ? new OracleConnection(arg) : null;
}
}