io.vertx.rxjava.cassandra.ResultSet 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.cassandra;
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.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;
/**
* It is like {@link com.datastax.driver.core.ResultSet}, but adapted for Vert.x.
*
*
* NOTE: This class has been automatically generated from the {@link io.vertx.cassandra.ResultSet original} non RX-ified interface using Vert.x codegen.
*/
@RxGen(io.vertx.cassandra.ResultSet.class)
public class ResultSet {
@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;
ResultSet that = (ResultSet) o;
return delegate.equals(that.delegate);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
public static final TypeArg __TYPE_ARG = new TypeArg<>( obj -> new ResultSet((io.vertx.cassandra.ResultSet) obj),
ResultSet::getDelegate
);
private final io.vertx.cassandra.ResultSet delegate;
public ResultSet(io.vertx.cassandra.ResultSet delegate) {
this.delegate = delegate;
}
public ResultSet(Object delegate) {
this.delegate = (io.vertx.cassandra.ResultSet)delegate;
}
public io.vertx.cassandra.ResultSet getDelegate() {
return delegate;
}
/**
* @return
*/
public boolean isExhausted() {
boolean ret = delegate.isExhausted();
return ret;
}
/**
* @return
*/
public boolean isFullyFetched() {
boolean ret = delegate.isFullyFetched();
return ret;
}
/**
* @return
*/
public int getAvailableWithoutFetching() {
int ret = delegate.getAvailableWithoutFetching();
return ret;
}
/**
* @param handler handler called when result is fetched
* @return
*/
public io.vertx.rxjava.cassandra.ResultSet fetchMoreResults(Handler> handler) {
delegate.fetchMoreResults(handler);
return this;
}
/**
* @return
*/
public Single rxFetchMoreResults() {
return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> {
fetchMoreResults(fut);
}));
}
/**
* @return
*/
public boolean wasApplied() {
boolean ret = delegate.wasApplied();
return ret;
}
/**
* The method should not be used concurrently with others like {@link io.vertx.rxjava.cassandra.ResultSet#several} or {@link io.vertx.rxjava.cassandra.ResultSet#all}.
* This may lead to unexpected result.
* @param handler handler called when one row is fetched
* @return
*/
public io.vertx.rxjava.cassandra.ResultSet one(Handler> handler) {
delegate.one(handler);
return this;
}
/**
* The method should not be used concurrently with others like {@link io.vertx.rxjava.cassandra.ResultSet#several} or {@link io.vertx.rxjava.cassandra.ResultSet#all}.
* This may lead to unexpected result.
* @return
*/
public Single rxOne() {
return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> {
one(fut);
}));
}
/**
* Fetch a specific amount of rows and notify via a handler.
*
* If remaining amount of rows in a result set is less than desired amount of rows to fetch,
* the handler
will be called with a successful result encompassing just the remaining rows.
*
*
* The method should not be used concurrently with others like {@link io.vertx.rxjava.cassandra.ResultSet#one} or {@link io.vertx.rxjava.cassandra.ResultSet#all}.
* This may lead to unexpected result.
* @param amount the amount
* @param handler the handler
* @return
*/
public io.vertx.rxjava.cassandra.ResultSet several(int amount, Handler>> handler) {
delegate.several(amount, handler);
return this;
}
/**
* Fetch a specific amount of rows and notify via a handler.
*
* If remaining amount of rows in a result set is less than desired amount of rows to fetch,
* the handler
will be called with a successful result encompassing just the remaining rows.
*
*
* The method should not be used concurrently with others like {@link io.vertx.rxjava.cassandra.ResultSet#one} or {@link io.vertx.rxjava.cassandra.ResultSet#all}.
* This may lead to unexpected result.
* @param amount the amount
* @return
*/
public Single> rxSeveral(int amount) {
return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> {
several(amount, fut);
}));
}
/**
* The method should not be used concurrently with others like {@link io.vertx.rxjava.cassandra.ResultSet#several} or {@link io.vertx.rxjava.cassandra.ResultSet#one}.
* This may lead to unexpected result.
* @param handler handler called when all the rows is fetched
* @return
*/
public io.vertx.rxjava.cassandra.ResultSet all(Handler>> handler) {
delegate.all(handler);
return this;
}
/**
* The method should not be used concurrently with others like {@link io.vertx.rxjava.cassandra.ResultSet#several} or {@link io.vertx.rxjava.cassandra.ResultSet#one}.
* This may lead to unexpected result.
* @return
*/
public Single> rxAll() {
return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> {
all(fut);
}));
}
/**
* @return
*/
public com.datastax.driver.core.ColumnDefinitions getColumnDefinitions() {
com.datastax.driver.core.ColumnDefinitions ret = delegate.getColumnDefinitions();
return ret;
}
/**
* @return
*/
public com.datastax.driver.core.ExecutionInfo getExecutionInfo() {
com.datastax.driver.core.ExecutionInfo ret = delegate.getExecutionInfo();
return ret;
}
/**
* @return
*/
public List getAllExecutionInfo() {
List ret = delegate.getAllExecutionInfo();
return ret;
}
public static ResultSet newInstance(io.vertx.cassandra.ResultSet arg) {
return arg != null ? new ResultSet(arg) : null;
}
}