change version and add more scala future methods

This commit is contained in:
Albert Shift 2015-06-03 12:51:05 -07:00
parent 869fd0aae3
commit a4260436e8
4 changed files with 85 additions and 2 deletions

View file

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.noorq.casser</groupId>
<artifactId>casser-core</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.0_2.11-SNAPSHOT</version>
<packaging>jar</packaging>
<name>casser</name>

View file

@ -24,6 +24,7 @@ import com.google.common.base.Function;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.noorq.casser.core.AbstractSessionOperations;
import com.noorq.casser.support.Fun;
import com.noorq.casser.support.Scala;
public abstract class AbstractOperation<E, O extends AbstractOperation<E, O>> extends AbstractStatementOperation<E, O> {
@ -56,6 +57,22 @@ public abstract class AbstractOperation<E, O extends AbstractOperation<E, O>> ex
public Future<PreparedOperation<E>> prepareFuture() {
return Scala.asFuture(prepareAsync());
}
public <A> Future<Fun.Tuple2<PreparedOperation<E>, A>> prepareFuture(A a) {
return Scala.asFuture(prepareAsync(), a);
}
public <A, B> Future<Fun.Tuple3<PreparedOperation<E>, A, B>> prepareFuture(A a, B b) {
return Scala.asFuture(prepareAsync(), a, b);
}
public <A, B, C> Future<Fun.Tuple4<PreparedOperation<E>, A, B, C>> prepareFuture(A a, B b, C c) {
return Scala.asFuture(prepareAsync(), a, b, c);
}
public <A, B, C, D> Future<Fun.Tuple5<PreparedOperation<E>, A, B, C, D>> prepareFuture(A a, B b, C c, D d) {
return Scala.asFuture(prepareAsync(), a, b, c, d);
}
public E sync() {
@ -84,4 +101,20 @@ public abstract class AbstractOperation<E, O extends AbstractOperation<E, O>> ex
return Scala.asFuture(async());
}
public <A> Future<Fun.Tuple2<E, A>> future(A a) {
return Scala.asFuture(async(), a);
}
public <A, B> Future<Fun.Tuple3<E, A, B>> future(A a, B b) {
return Scala.asFuture(async(), a, b);
}
public <A, B, C> Future<Fun.Tuple4<E, A, B, C>> future(A a, B b, C c) {
return Scala.asFuture(async(), a, b, c);
}
public <A, B, C, D> Future<Fun.Tuple5<E, A, B, C, D>> future(A a, B b, C c, D d) {
return Scala.asFuture(async(), a, b, c, d);
}
}

View file

@ -32,6 +32,7 @@ import com.datastax.driver.core.querybuilder.BuiltStatement;
import com.google.common.util.concurrent.ListenableFuture;
import com.noorq.casser.core.AbstractSessionOperations;
import com.noorq.casser.support.CasserException;
import com.noorq.casser.support.Fun;
import com.noorq.casser.support.Scala;
public abstract class AbstractStatementOperation<E, O extends AbstractStatementOperation<E, O>> {
@ -237,5 +238,21 @@ public abstract class AbstractStatementOperation<E, O extends AbstractStatementO
public Future<PreparedStatement> prepareStatementFuture() {
return Scala.asFuture(prepareStatementAsync());
}
public <A> Future<Fun.Tuple2<PreparedStatement, A>> prepareStatementFuture(A a) {
return Scala.asFuture(prepareStatementAsync(), a);
}
public <A, B> Future<Fun.Tuple3<PreparedStatement, A, B>> prepareStatementFuture(A a, B b) {
return Scala.asFuture(prepareStatementAsync(), a, b);
}
public <A, B, C> Future<Fun.Tuple4<PreparedStatement, A, B, C>> prepareStatementFuture(A a, B b, C c) {
return Scala.asFuture(prepareStatementAsync(), a, b, c);
}
public <A, B, C, D> Future<Fun.Tuple5<PreparedStatement, A, B, C, D>> prepareStatementFuture(A a, B b, C c, D d) {
return Scala.asFuture(prepareStatementAsync(), a, b, c, d);
}
}

View file

@ -26,6 +26,7 @@ import com.google.common.base.Function;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.noorq.casser.core.AbstractSessionOperations;
import com.noorq.casser.support.Fun;
import com.noorq.casser.support.Scala;
public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperation<E, O>> extends AbstractStatementOperation<E, O> {
@ -59,6 +60,22 @@ public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperati
return Scala.asFuture(prepareAsync());
}
public <A> Future<Fun.Tuple2<PreparedStreamOperation<E>, A>> prepareFuture(A a) {
return Scala.asFuture(prepareAsync(), a);
}
public <A, B> Future<Fun.Tuple3<PreparedStreamOperation<E>, A, B>> prepareFuture(A a, B b) {
return Scala.asFuture(prepareAsync(), a, b);
}
public <A, B, C> Future<Fun.Tuple4<PreparedStreamOperation<E>, A, B, C>> prepareFuture(A a, B b, C c) {
return Scala.asFuture(prepareAsync(), a, b, c);
}
public <A, B, C, D> Future<Fun.Tuple5<PreparedStreamOperation<E>, A, B, C, D>> prepareFuture(A a, B b, C c, D d) {
return Scala.asFuture(prepareAsync(), a, b, c, d);
}
public Stream<E> sync() {
ResultSet resultSet = sessionOps.executeAsync(options(buildStatement()), showValues).getUninterruptibly();
@ -85,5 +102,21 @@ public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperati
public Future<Stream<E>> future() {
return Scala.asFuture(async());
}
public <A> Future<Fun.Tuple2<Stream<E>, A>> future(A a) {
return Scala.asFuture(async(), a);
}
public <A, B> Future<Fun.Tuple3<Stream<E>, A, B>> future(A a, B b) {
return Scala.asFuture(async(), a, b);
}
public <A, B, C> Future<Fun.Tuple4<Stream<E>, A, B, C>> future(A a, B b, C c) {
return Scala.asFuture(async(), a, b, c);
}
public <A, B, C, D> Future<Fun.Tuple5<Stream<E>, A, B, C, D>> future(A a, B b, C c, D d) {
return Scala.asFuture(async(), a, b, c, d);
}
}