unification of tuple names and variables

This commit is contained in:
Albert Shift 2015-03-30 13:47:51 -07:00
parent 538d5854a6
commit 427cf4ab7a
10 changed files with 109 additions and 109 deletions

View file

@ -43,12 +43,12 @@ public class Example {
@Override
public String name() {
return t.v1;
return t._1;
}
@Override
public Integer age() {
return t.v2;
return t._2;
}
};
@ -87,7 +87,7 @@ public class Example {
session.upsert(newUser);
String nameAndAge = session.select(user::name, user::age).where(user::id, "==", 100L).sync().findFirst().map(t -> {
return t.v1 + ":" + t.v2;
return t._1 + ":" + t._2;
}).get();
User userTmp = session.select(user::name, user::age).where(user::id, "==", 100L).map(Example::mapUser).sync().findFirst().get();

View file

@ -22,15 +22,15 @@ import com.noorq.casser.core.reflect.CasserPropertyNode;
import com.noorq.casser.mapping.CasserMappingProperty;
import com.noorq.casser.mapping.value.ColumnValueProvider;
public final class Tuple1<V1> {
public final class Tuple1<A> {
public final V1 v1;
public final A _1;
public Tuple1(V1 v1) {
this.v1 = v1;
public Tuple1(A v1) {
this._1 = v1;
}
public final static class Mapper<V1> implements Function<Row, Tuple1<V1>> {
public final static class Mapper<A> implements Function<Row, Tuple1<A>> {
private final ColumnValueProvider provider;
private final CasserMappingProperty p1;
@ -41,15 +41,15 @@ public final class Tuple1<V1> {
}
@Override
public Tuple1<V1> apply(Row row) {
return new Tuple1<V1>(provider.getColumnValue(row, 0, p1));
public Tuple1<A> apply(Row row) {
return new Tuple1<A>(provider.getColumnValue(row, 0, p1));
}
}
@Override
public String toString() {
return "Tuple1 [v1=" + v1 + "]";
return "Tuple1 [_1=" + _1 + "]";
}

View file

@ -22,17 +22,17 @@ import com.noorq.casser.core.reflect.CasserPropertyNode;
import com.noorq.casser.mapping.CasserMappingProperty;
import com.noorq.casser.mapping.value.ColumnValueProvider;
public final class Tuple2<V1, V2> {
public final class Tuple2<A, B> {
public final V1 v1;
public final V2 v2;
public final A _1;
public final B _2;
public Tuple2(V1 v1, V2 v2) {
this.v1 = v1;
this.v2 = v2;
public Tuple2(A v1, B v2) {
this._1 = v1;
this._2 = v2;
}
public final static class Mapper<V1, V2> implements Function<Row, Tuple2<V1, V2>> {
public final static class Mapper<A, B> implements Function<Row, Tuple2<A, B>> {
private final ColumnValueProvider provider;
private final CasserMappingProperty p1;
@ -47,8 +47,8 @@ public final class Tuple2<V1, V2> {
}
@Override
public Tuple2<V1, V2> apply(Row row) {
return new Tuple2<V1, V2>(
public Tuple2<A, B> apply(Row row) {
return new Tuple2<A, B>(
provider.getColumnValue(row, 0, p1),
provider.getColumnValue(row, 1, p2));
}
@ -56,7 +56,7 @@ public final class Tuple2<V1, V2> {
@Override
public String toString() {
return "Tuple2 [v1=" + v1 + ", v2=" + v2 + "]";
return "Tuple2 [_1=" + _1 + ", _2=" + _2 + "]";
}

View file

@ -22,19 +22,19 @@ import com.noorq.casser.core.reflect.CasserPropertyNode;
import com.noorq.casser.mapping.CasserMappingProperty;
import com.noorq.casser.mapping.value.ColumnValueProvider;
public final class Tuple3<V1, V2, V3> {
public final class Tuple3<A, B, C> {
public final V1 v1;
public final V2 v2;
public final V3 v3;
public final A _1;
public final B _2;
public final C _3;
public Tuple3(V1 v1, V2 v2, V3 v3) {
this.v1 = v1;
this.v2 = v2;
this.v3 = v3;
public Tuple3(A v1, B v2, C v3) {
this._1 = v1;
this._2 = v2;
this._3 = v3;
}
public final static class Mapper<V1, V2, V3> implements Function<Row, Tuple3<V1, V2, V3>> {
public final static class Mapper<A, B, C> implements Function<Row, Tuple3<A, B, C>> {
private final ColumnValueProvider provider;
private final CasserMappingProperty p1;
@ -52,8 +52,8 @@ public final class Tuple3<V1, V2, V3> {
}
@Override
public Tuple3<V1, V2, V3> apply(Row row) {
return new Tuple3<V1, V2, V3>(
public Tuple3<A, B, C> apply(Row row) {
return new Tuple3<A, B, C>(
provider.getColumnValue(row, 0, p1),
provider.getColumnValue(row, 1, p2),
provider.getColumnValue(row, 2, p3)
@ -63,7 +63,7 @@ public final class Tuple3<V1, V2, V3> {
@Override
public String toString() {
return "Tuple3 [v1=" + v1 + ", v2=" + v2 + ", v3=" + v3 + "]";
return "Tuple3 [_1=" + _1 + ", _2=" + _2 + ", _3=" + _3 + "]";
}

View file

@ -22,21 +22,21 @@ import com.noorq.casser.core.reflect.CasserPropertyNode;
import com.noorq.casser.mapping.CasserMappingProperty;
import com.noorq.casser.mapping.value.ColumnValueProvider;
public final class Tuple4<V1, V2, V3, V4> {
public final class Tuple4<A, B, C, D> {
public final V1 v1;
public final V2 v2;
public final V3 v3;
public final V4 v4;
public final A _1;
public final B _2;
public final C _3;
public final D _4;
public Tuple4(V1 v1, V2 v2, V3 v3, V4 v4) {
this.v1 = v1;
this.v2 = v2;
this.v3 = v3;
this.v4 = v4;
public Tuple4(A v1, B v2, C v3, D v4) {
this._1 = v1;
this._2 = v2;
this._3 = v3;
this._4 = v4;
}
public final static class Mapper<V1, V2, V3, V4> implements Function<Row, Tuple4<V1, V2, V3, V4>> {
public final static class Mapper<A, B, C, D> implements Function<Row, Tuple4<A, B, C, D>> {
private final ColumnValueProvider provider;
private final CasserMappingProperty p1;
@ -58,8 +58,8 @@ public final class Tuple4<V1, V2, V3, V4> {
}
@Override
public Tuple4<V1, V2, V3, V4> apply(Row row) {
return new Tuple4<V1, V2, V3, V4>(
public Tuple4<A, B, C, D> apply(Row row) {
return new Tuple4<A, B, C, D>(
provider.getColumnValue(row, 0, p1),
provider.getColumnValue(row, 1, p2),
provider.getColumnValue(row, 2, p3),
@ -70,7 +70,7 @@ public final class Tuple4<V1, V2, V3, V4> {
@Override
public String toString() {
return "Tuple4 [v1=" + v1 + ", v2=" + v2 + ", v3=" + v3 + ", v4=" + v4
return "Tuple4 [_1=" + _1 + ", _2=" + _2 + ", _3=" + _3 + ", _4=" + _4
+ "]";
}

View file

@ -22,23 +22,23 @@ import com.noorq.casser.core.reflect.CasserPropertyNode;
import com.noorq.casser.mapping.CasserMappingProperty;
import com.noorq.casser.mapping.value.ColumnValueProvider;
public final class Tuple5<V1, V2, V3, V4, V5> {
public final class Tuple5<A, B, C, D, E> {
public final V1 v1;
public final V2 v2;
public final V3 v3;
public final V4 v4;
public final V5 v5;
public final A _1;
public final B _2;
public final C _3;
public final D _4;
public final E _5;
public Tuple5(V1 v1, V2 v2, V3 v3, V4 v4, V5 v5) {
this.v1 = v1;
this.v2 = v2;
this.v3 = v3;
this.v4 = v4;
this.v5 = v5;
public Tuple5(A v1, B v2, C v3, D v4, E v5) {
this._1 = v1;
this._2 = v2;
this._3 = v3;
this._4 = v4;
this._5 = v5;
}
public final static class Mapper<V1, V2, V3, V4, V5> implements Function<Row, Tuple5<V1, V2, V3, V4, V5>> {
public final static class Mapper<A, B, C, D, E> implements Function<Row, Tuple5<A, B, C, D, E>> {
private final ColumnValueProvider provider;
private final CasserMappingProperty p1, p2, p3, p4, p5;
@ -59,8 +59,8 @@ public final class Tuple5<V1, V2, V3, V4, V5> {
}
@Override
public Tuple5<V1, V2, V3, V4, V5> apply(Row row) {
return new Tuple5<V1, V2, V3, V4, V5>(
public Tuple5<A, B, C, D, E> apply(Row row) {
return new Tuple5<A, B, C, D, E>(
provider.getColumnValue(row, 0, p1),
provider.getColumnValue(row, 1, p2),
provider.getColumnValue(row, 2, p3),
@ -72,8 +72,8 @@ public final class Tuple5<V1, V2, V3, V4, V5> {
@Override
public String toString() {
return "Tuple5 [v1=" + v1 + ", v2=" + v2 + ", v3=" + v3 + ", v4=" + v4
+ ", v5=" + v5 + "]";
return "Tuple5 [_1=" + _1 + ", _2=" + _2 + ", _3=" + _3 + ", _4=" + _4
+ ", _5=" + _5 + "]";
}

View file

@ -22,27 +22,27 @@ import com.noorq.casser.core.reflect.CasserPropertyNode;
import com.noorq.casser.mapping.CasserMappingProperty;
import com.noorq.casser.mapping.value.ColumnValueProvider;
public final class Tuple6<V1, V2, V3, V4, V5, V6> {
public final class Tuple6<A, B, C, D, E, F> {
public final V1 v1;
public final V2 v2;
public final V3 v3;
public final V4 v4;
public final V5 v5;
public final V6 v6;
public final A _1;
public final B _2;
public final C _3;
public final D _4;
public final E _5;
public final F _6;
public Tuple6(V1 v1, V2 v2, V3 v3, V4 v4, V5 v5, V6 v6) {
this.v1 = v1;
this.v2 = v2;
this.v3 = v3;
this.v4 = v4;
this.v5 = v5;
this.v6 = v6;
public Tuple6(A v1, B v2, C v3, D v4, E v5, F v6) {
this._1 = v1;
this._2 = v2;
this._3 = v3;
this._4 = v4;
this._5 = v5;
this._6 = v6;
}
public final static class Mapper<V1, V2, V3, V4, V5, V6> implements
public final static class Mapper<A, B, C, D, E, F> implements
Function<Row,
Tuple6<V1, V2, V3, V4, V5, V6>> {
Tuple6<A, B, C, D, E, F>> {
private final ColumnValueProvider provider;
private final CasserMappingProperty p1, p2, p3, p4, p5, p6;
@ -65,8 +65,8 @@ public final class Tuple6<V1, V2, V3, V4, V5, V6> {
}
@Override
public Tuple6<V1, V2, V3, V4, V5, V6> apply(Row row) {
return new Tuple6<V1, V2, V3, V4, V5, V6>(
public Tuple6<A, B, C, D, E, F> apply(Row row) {
return new Tuple6<A, B, C, D, E, F>(
provider.getColumnValue(row, 0, p1),
provider.getColumnValue(row, 1, p2),
provider.getColumnValue(row, 2, p3),
@ -79,8 +79,8 @@ public final class Tuple6<V1, V2, V3, V4, V5, V6> {
@Override
public String toString() {
return "Tuple6 [v1=" + v1 + ", v2=" + v2 + ", v3=" + v3 + ", v4=" + v4
+ ", v5=" + v5 + ", v6=" + v6 + "]";
return "Tuple6 [_1=" + _1 + ", _2=" + _2 + ", _3=" + _3 + ", _4=" + _4
+ ", _5=" + _5 + ", _6=" + _6 + "]";
}

View file

@ -22,29 +22,29 @@ import com.noorq.casser.core.reflect.CasserPropertyNode;
import com.noorq.casser.mapping.CasserMappingProperty;
import com.noorq.casser.mapping.value.ColumnValueProvider;
public final class Tuple7<V1, V2, V3, V4, V5, V6, V7> {
public final class Tuple7<A, B, C, D, E, F, G> {
public final V1 v1;
public final V2 v2;
public final V3 v3;
public final V4 v4;
public final V5 v5;
public final V6 v6;
public final V7 v7;
public final A _1;
public final B _2;
public final C _3;
public final D _4;
public final E _5;
public final F _6;
public final G _7;
public Tuple7(V1 v1, V2 v2, V3 v3, V4 v4, V5 v5, V6 v6, V7 v7) {
this.v1 = v1;
this.v2 = v2;
this.v3 = v3;
this.v4 = v4;
this.v5 = v5;
this.v6 = v6;
this.v7 = v7;
public Tuple7(A v1, B v2, C v3, D v4, E v5, F v6, G v7) {
this._1 = v1;
this._2 = v2;
this._3 = v3;
this._4 = v4;
this._5 = v5;
this._6 = v6;
this._7 = v7;
}
public final static class Mapper<V1, V2, V3, V4, V5, V6, V7> implements
public final static class Mapper<A, B, C, D, E, F, G> implements
Function<Row,
Tuple7<V1, V2, V3, V4, V5, V6, V7>> {
Tuple7<A, B, C, D, E, F, G>> {
private final ColumnValueProvider provider;
private final CasserMappingProperty p1, p2, p3, p4, p5, p6, p7;
@ -69,8 +69,8 @@ public final class Tuple7<V1, V2, V3, V4, V5, V6, V7> {
}
@Override
public Tuple7<V1, V2, V3, V4, V5, V6, V7> apply(Row row) {
return new Tuple7<V1, V2, V3, V4, V5, V6, V7>(
public Tuple7<A, B, C, D, E, F, G> apply(Row row) {
return new Tuple7<A, B, C, D, E, F, G>(
provider.getColumnValue(row, 0, p1),
provider.getColumnValue(row, 1, p2),
provider.getColumnValue(row, 2, p3),
@ -84,8 +84,8 @@ public final class Tuple7<V1, V2, V3, V4, V5, V6, V7> {
@Override
public String toString() {
return "Tuple7 [v1=" + v1 + ", v2=" + v2 + ", v3=" + v3 + ", v4=" + v4
+ ", v5=" + v5 + ", v6=" + v6 + ", v7=" + v7 + "]";
return "Tuple7 [_1=" + _1 + ", _2=" + _2 + ", _3=" + _3 + ", _4=" + _4
+ ", _5=" + _5 + ", _6=" + _6 + ", _7=" + _7 + "]";
}

View file

@ -97,9 +97,9 @@ public class CompondKeyTest extends AbstractEmbeddedCassandraTest {
Date cd = d.get();
if (cd != null) {
Assert.assertTrue(cd.after(t.v2));
Assert.assertTrue(cd.after(t._2));
}
d.set(t.v2);
d.set(t._2);
});

View file

@ -81,7 +81,7 @@ public class SimpleUserTest extends AbstractEmbeddedCassandraTest {
String name = session.select(user::name)
.where(user::id, "==", 123L)
.map(t -> "_" + t.v1)
.map(t -> "_" + t._1)
.sync()
.findFirst()
.get();