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

io.vertx.rxjava3.sqlclient.ClientBuilder Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR2
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.vertx.rxjava3.sqlclient;

import io.vertx.rxjava3.RxHelper;
import io.vertx.rxjava3.ObservableHelper;
import io.vertx.rxjava3.FlowableHelper;
import io.vertx.rxjava3.impl.AsyncResultMaybe;
import io.vertx.rxjava3.impl.AsyncResultSingle;
import io.vertx.rxjava3.impl.AsyncResultCompletable;
import io.vertx.rxjava3.WriteStreamObserver;
import io.vertx.rxjava3.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;

/**
 * Builder for {@link io.vertx.rxjava3.sqlclient.SqlClient} instances.
 *
 * 

* NOTE: This class has been automatically generated from the {@link io.vertx.sqlclient.ClientBuilder original} non RX-ified interface using Vert.x codegen. */ @RxGen(io.vertx.sqlclient.ClientBuilder.class) public class ClientBuilder { @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; ClientBuilder that = (ClientBuilder) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final TypeArg __TYPE_ARG = new TypeArg<>( obj -> new ClientBuilder((io.vertx.sqlclient.ClientBuilder) obj), ClientBuilder::getDelegate ); private final io.vertx.sqlclient.ClientBuilder delegate; public final TypeArg __typeArg_0; public ClientBuilder(io.vertx.sqlclient.ClientBuilder delegate) { this.delegate = delegate; this.__typeArg_0 = TypeArg.unknown(); } public ClientBuilder(Object delegate, TypeArg typeArg_0) { this.delegate = (io.vertx.sqlclient.ClientBuilder)delegate; this.__typeArg_0 = typeArg_0; } public io.vertx.sqlclient.ClientBuilder getDelegate() { return delegate; } /** * Configure the client with the given pool options * @param options the pool options * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava3.sqlclient.ClientBuilder with(io.vertx.sqlclient.PoolOptions options) { delegate.with(options); return this; } /** * Configure the database the client should connect to. The target database is specified as * a {@link io.vertx.sqlclient.SqlConnectOptions} coordinates. * @param database the database coordinates * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava3.sqlclient.ClientBuilder connectingTo(io.vertx.sqlclient.SqlConnectOptions database) { delegate.connectingTo(database); return this; } /** * Configure the database the client should connect to. The target database is specified as * a {@link io.vertx.sqlclient.SqlConnectOptions} coordinates. * @param database the database URI * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava3.sqlclient.ClientBuilder connectingTo(java.lang.String database) { delegate.connectingTo(database); return this; } /** * Configure the database the client should connect to. When the client needs to connect to the database, * it gets a database configuration from the list of databases using a round-robin policy. * @param databases the list of database coordinates * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava3.sqlclient.ClientBuilder connectingTo(java.util.List databases) { delegate.connectingTo(databases); return this; } /** * Sets the vertx instance to use. * @param vertx the vertx instance * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava3.sqlclient.ClientBuilder using(io.vertx.rxjava3.core.Vertx vertx) { delegate.using(vertx.getDelegate()); return this; } /** * Set a handler called when the pool has established a connection to the database. * *

This handler allows interactions with the database before the connection is added to the pool. * *

When the handler has finished, it must call {@link io.vertx.rxjava3.sqlclient.SqlClient#close} to release the connection * to the pool. * @param handler the handler * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava3.sqlclient.ClientBuilder withConnectHandler(io.vertx.core.Handler handler) { delegate.withConnectHandler(new io.vertx.lang.rx.DelegatingHandler<>(handler, event -> io.vertx.rxjava3.sqlclient.SqlConnection.newInstance((io.vertx.sqlclient.SqlConnection)event))); return this; } /** * Build and return the client. * @return the client */ public C build() { C ret = (C)__typeArg_0.wrap(delegate.build()); return ret; } /** * Configure the database the client should connect to. When the client needs to connect to the database, * it gets fresh database configuration from the database supplier. * @param supplier the supplier of database coordinates * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava3.sqlclient.ClientBuilder connectingTo(java.util.function.Supplier> supplier) { delegate.connectingTo(supplier); return this; } public static ClientBuilder newInstance(io.vertx.sqlclient.ClientBuilder arg) { return arg != null ? new ClientBuilder(arg) : null; } public static ClientBuilder newInstance(io.vertx.sqlclient.ClientBuilder arg, TypeArg __typeArg_C) { return arg != null ? new ClientBuilder(arg, __typeArg_C) : null; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy