Elffuss BraidHub

kikocis/java-driver public

use generics in QueryBuilder's API
Changeset477ed7b8ab6cd0818f54d5f89bec1132dcb0ade607e20b038a2f7fa37dc074ff
Authorolivier bourgain <olivierbourgain02@gmail.com> · 2015-01-15 23:27 +01:00
Committerolivier bourgain <olivierbourgain02@gmail.com> · 2015-01-15 23:27 +01:00
Parents3e4679db605a

Browse the files at this changeset

4 files changed

modified driver-core/src/main/java/com/datastax/driver/core/querybuilder/Clause.java +4 −4
@@ -66,9 +66,9 @@
6666
6767 static class InClause extends AbstractClause {
6868
69- private final List<Object> values;
69+ private final List<?> values;
7070
71- InClause(String name, List<Object> values) {
71+ InClause(String name, List<?> values) {
7272 super(name);
7373 this.values = values;
7474
@@ -114,9 +114,9 @@
114114 static class CompoundClause extends Clause {
115115 private String op;
116116 private final List<String> names;
117- private final List<Object> values;
117+ private final List<?> values;
118118
119- CompoundClause(List<String> names, String op, List<Object> values) {
119+ CompoundClause(List<String> names, String op, List<?> values) {
120120 assert names.size() == values.size();
121121 this.op = op;
122122 this.names = names;
modified driver-core/src/main/java/com/datastax/driver/core/querybuilder/Delete.java +2 −2
@@ -27,13 +27,13 @@
2727 public class Delete extends BuiltStatement {
2828
2929 private final String table;
30- private final List<Object> columnNames;
30+ private final List<?> columnNames;
3131 private final Where where;
3232 private final Options usings;
3333 private final Conditions conditions;
3434 private boolean ifExists;
3535
36- Delete(String keyspace, String table, List<Object> columnNames) {
36+ Delete(String keyspace, String table, List<?> columnNames) {
3737 super(keyspace);
3838 this.table = table;
3939 this.columnNames = columnNames;
modified driver-core/src/main/java/com/datastax/driver/core/querybuilder/QueryBuilder.java +5 −5
@@ -295,7 +295,7 @@
295295 * @param values the values
296296 * @return the corresponding where clause.
297297 */
298- public static Clause in(String name, List<Object> values) {
298+ public static Clause in(String name, List<?> values) {
299299 return new Clause.InClause(name, values);
300300 }
301301
@@ -325,7 +325,7 @@
325325 *
326326 * @throws IllegalArgumentException if {@code names.size() != values.size()}.
327327 */
328- public static Clause lt(List<String> names, List<Object> values) {
328+ public static Clause lt(List<String> names, List<?> values) {
329329 if (names.size() != values.size())
330330 throw new IllegalArgumentException(String.format("The number of names (%d) and values (%d) don't match", names.size(), values.size()));
331331
@@ -358,7 +358,7 @@
358358 *
359359 * @throws IllegalArgumentException if {@code names.size() != values.size()}.
360360 */
361- public static Clause lte(List<String> names, List<Object> values) {
361+ public static Clause lte(List<String> names, List<?> values) {
362362 if (names.size() != values.size())
363363 throw new IllegalArgumentException(String.format("The number of names (%d) and values (%d) don't match", names.size(), values.size()));
364364
@@ -391,7 +391,7 @@
391391 *
392392 * @throws IllegalArgumentException if {@code names.size() != values.size()}.
393393 */
394- public static Clause gt(List<String> names, List<Object> values) {
394+ public static Clause gt(List<String> names, List<?> values) {
395395 if (names.size() != values.size())
396396 throw new IllegalArgumentException(String.format("The number of names (%d) and values (%d) don't match", names.size(), values.size()));
397397
@@ -424,7 +424,7 @@
424424 *
425425 * @throws IllegalArgumentException if {@code names.size() != values.size()}.
426426 */
427- public static Clause gte(List<String> names, List<Object> values) {
427+ public static Clause gte(List<String> names, List<?> values) {
428428 if (names.size() != values.size())
429429 throw new IllegalArgumentException(String.format("The number of names (%d) and values (%d) don't match", names.size(), values.size()));
430430
modified driver-core/src/main/java/com/datastax/driver/core/querybuilder/Utils.java +4 −4
@@ -40,7 +40,7 @@
4040 return sb;
4141 }
4242
43- static StringBuilder joinAndAppendNames(StringBuilder sb, String separator, List<Object> values) {
43+ static StringBuilder joinAndAppendNames(StringBuilder sb, String separator, List<?> values) {
4444 for (int i = 0; i < values.size(); i++) {
4545 if (i > 0)
4646 sb.append(separator);
@@ -49,7 +49,7 @@
4949 return sb;
5050 }
5151
52- static StringBuilder joinAndAppendValues(StringBuilder sb, String separator, List<Object> values, List<ByteBuffer> variables) {
52+ static StringBuilder joinAndAppendValues(StringBuilder sb, String separator, List<?> values, List<ByteBuffer> variables) {
5353 for (int i = 0; i < values.size(); i++) {
5454 if (i > 0)
5555 sb.append(separator);
@@ -142,7 +142,7 @@
142142 sb.append(((Date)value).getTime());
143143 return true;
144144 } else if (value instanceof ByteBuffer) {
145- sb.append(Bytes.toHexString((ByteBuffer)value));
145+ sb.append(Bytes.toHexString((ByteBuffer) value));
146146 return true;
147147 } else if (value instanceof BindMarker) {
148148 sb.append(value);
@@ -171,7 +171,7 @@
171171 @SuppressWarnings("rawtypes")
172172 private static boolean appendValueIfCollection(Object value, StringBuilder sb, boolean rawValue) {
173173 if (value instanceof List) {
174- appendList((List)value, sb, rawValue);
174+ appendList((List) value, sb, rawValue);
175175 return true;
176176 } else if (value instanceof Set) {
177177 appendSet((Set)value, sb, rawValue);