Skip to content

Commit 2dade7d

Browse files
committed
Cleanup in Row/Tuple: the getValues(Class) is replaced by get (e.g instead of getValues(String.class, 0) then get(String[].class, 0)) and addValues is replaced by addValue.
1 parent 5732cff commit 2dade7d

File tree

14 files changed

+263
-410
lines changed

14 files changed

+263
-410
lines changed

vertx-db2-client/src/main/java/io/vertx/db2client/impl/DB2RowImpl.java

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,45 +44,40 @@ public DB2RowImpl(RowDesc rowDesc) {
4444
}
4545

4646
@Override
47-
public <T> T get(Class<T> type, int pos) {
47+
public <T> T get(Class<T> type, int position) {
4848
if (type == Boolean.class) {
49-
return type.cast(getBoolean(pos));
49+
return type.cast(getBoolean(position));
5050
} else if (type == Byte.class) {
51-
return type.cast(getByte(pos));
51+
return type.cast(getByte(position));
5252
} else if (type == Short.class) {
53-
return type.cast(getShort(pos));
53+
return type.cast(getShort(position));
5454
} else if (type == Integer.class) {
55-
return type.cast(getInteger(pos));
55+
return type.cast(getInteger(position));
5656
} else if (type == Long.class) {
57-
return type.cast(getLong(pos));
57+
return type.cast(getLong(position));
5858
} else if (type == Float.class) {
59-
return type.cast(getFloat(pos));
59+
return type.cast(getFloat(position));
6060
} else if (type == Double.class) {
61-
return type.cast(getDouble(pos));
61+
return type.cast(getDouble(position));
6262
} else if (type == Numeric.class) {
63-
return type.cast(getNumeric(pos));
63+
return type.cast(getNumeric(position));
6464
} else if (type == String.class) {
65-
return type.cast(getString(pos));
65+
return type.cast(getString(position));
6666
} else if (type == Buffer.class) {
67-
return type.cast(getBuffer(pos));
67+
return type.cast(getBuffer(position));
6868
} else if (type == LocalDate.class) {
69-
return type.cast(getLocalDate(pos));
69+
return type.cast(getLocalDate(position));
7070
} else if (type == LocalDateTime.class) {
71-
return type.cast(getLocalDateTime(pos));
71+
return type.cast(getLocalDateTime(position));
7272
} else if (type == Duration.class) {
73-
return type.cast(getDuration(pos));
73+
return type.cast(getDuration(position));
7474
} else if (type == RowId.class || type == DB2RowId.class) {
75-
return type.cast(getRowId(pos));
75+
return type.cast(getRowId(position));
7676
} else {
7777
throw new UnsupportedOperationException("Unsupported type " + type.getName());
7878
}
7979
}
8080

81-
@Override
82-
public <T> T[] getValues(Class<T> type, int idx) {
83-
throw new UnsupportedOperationException();
84-
}
85-
8681
@Override
8782
public String getColumnName(int pos) {
8883
List<String> columnNames = rowDesc.columnNames();
@@ -107,7 +102,7 @@ public Object getValue(String name) {
107102
int pos = getColumnIndex(name);
108103
return pos == -1 ? null : getValue(pos);
109104
}
110-
105+
111106
@Override
112107
public Boolean getBoolean(int pos) {
113108
// DB2 stores booleans as TINYINT
@@ -172,7 +167,7 @@ public Buffer getBuffer(String name) {
172167
int pos = getColumnIndex(name);
173168
return pos == -1 ? null : getBuffer(pos);
174169
}
175-
170+
176171
public RowId getRowId(int pos) {
177172
Object val = getValue(pos);
178173
if (val instanceof RowId) {
@@ -181,7 +176,7 @@ public RowId getRowId(int pos) {
181176
return null;
182177
}
183178
}
184-
179+
185180
public RowId getRowId(String name) {
186181
int pos = getColumnIndex(name);
187182
return pos == -1 ? null : getRowId(pos);
@@ -298,7 +293,7 @@ public Buffer[] getBufferArray(String name) {
298293
public UUID[] getUUIDArray(String name) {
299294
throw new UnsupportedOperationException();
300295
}
301-
296+
302297
private Numeric getNumeric(int pos) {
303298
Object val = getValue(pos);
304299
if (val instanceof Numeric) {

vertx-mssql-client/src/main/java/io/vertx/mssqlclient/impl/MSSQLRowImpl.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ public int getColumnIndex(String columnName) {
4444
return rowDesc.columnNames().indexOf(columnName);
4545
}
4646

47-
@Override
48-
public <T> T[] getValues(Class<T> type, int idx) {
49-
throw new UnsupportedOperationException();
50-
}
51-
5247
@Override
5348
public Buffer getBuffer(String columnName) {
5449
throw new UnsupportedOperationException();

vertx-mysql-client/src/main/java/io/vertx/mysqlclient/impl/MySQLRowImpl.java

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -41,63 +41,58 @@ public MySQLRowImpl(MySQLRowDesc rowDesc) {
4141
}
4242

4343
@Override
44-
public <T> T get(Class<T> type, int pos) {
44+
public <T> T get(Class<T> type, int position) {
4545
if (type == Boolean.class) {
46-
return type.cast(getBoolean(pos));
46+
return type.cast(getBoolean(position));
4747
} else if (type == Byte.class) {
48-
return type.cast(getByte(pos));
48+
return type.cast(getByte(position));
4949
} else if (type == Short.class) {
50-
return type.cast(getShort(pos));
50+
return type.cast(getShort(position));
5151
} else if (type == Integer.class) {
52-
return type.cast(getInteger(pos));
52+
return type.cast(getInteger(position));
5353
} else if (type == Long.class) {
54-
return type.cast(getLong(pos));
54+
return type.cast(getLong(position));
5555
} else if (type == Float.class) {
56-
return type.cast(getFloat(pos));
56+
return type.cast(getFloat(position));
5757
} else if (type == Double.class) {
58-
return type.cast(getDouble(pos));
58+
return type.cast(getDouble(position));
5959
} else if (type == Numeric.class) {
60-
return type.cast(getNumeric(pos));
60+
return type.cast(getNumeric(position));
6161
} else if (type == String.class) {
62-
return type.cast(getString(pos));
62+
return type.cast(getString(position));
6363
} else if (type == Buffer.class) {
64-
return type.cast(getBuffer(pos));
64+
return type.cast(getBuffer(position));
6565
} else if (type == LocalDate.class) {
66-
return type.cast(getLocalDate(pos));
66+
return type.cast(getLocalDate(position));
6767
} else if (type == LocalDateTime.class) {
68-
return type.cast(getLocalDateTime(pos));
68+
return type.cast(getLocalDateTime(position));
6969
} else if (type == Duration.class) {
70-
return type.cast(getDuration(pos));
70+
return type.cast(getDuration(position));
7171
} else if (type == JsonObject.class) {
72-
return type.cast(getJsonObject(pos));
72+
return type.cast(getJsonObject(position));
7373
} else if (type == JsonArray.class) {
74-
return type.cast(getJsonArray(pos));
74+
return type.cast(getJsonArray(position));
7575
} else if (type == Geometry.class) {
76-
return type.cast(getGeometry(pos));
76+
return type.cast(getGeometry(position));
7777
} else if (type == Point.class) {
78-
return type.cast(getPoint(pos));
78+
return type.cast(getPoint(position));
7979
} else if (type == LineString.class) {
80-
return type.cast(getLineString(pos));
80+
return type.cast(getLineString(position));
8181
} else if (type == Polygon.class) {
82-
return type.cast(getPolygon(pos));
82+
return type.cast(getPolygon(position));
8383
} else if (type == MultiPoint.class) {
84-
return type.cast(getMultiPoint(pos));
84+
return type.cast(getMultiPoint(position));
8585
} else if (type == MultiLineString.class) {
86-
return type.cast(getMultiLineString(pos));
86+
return type.cast(getMultiLineString(position));
8787
} else if (type == MultiPolygon.class) {
88-
return type.cast(getMultiPolygon(pos));
88+
return type.cast(getMultiPolygon(position));
8989
} else if (type == GeometryCollection.class) {
90-
return type.cast(getGeometryCollection(pos));
90+
return type.cast(getGeometryCollection(position));
9191
} else {
9292
throw new UnsupportedOperationException("Unsupported type " + type.getName());
9393
}
9494
}
9595

96-
@Override
97-
public <T> T[] getValues(Class<T> type, int idx) {
98-
throw new UnsupportedOperationException("MySQL Array data type is not supported");
99-
}
100-
10196
@Override
10297
public String getColumnName(int pos) {
10398
List<String> columnNames = rowDesc.columnNames();

0 commit comments

Comments
 (0)