Skip to content

Commit 06f3687

Browse files
committed
Refactor ColumnSource to NamedCollectionSupport
Signed-off-by: Mark Paluch <mpaluch@vmware.com> [#199]
1 parent 9efe389 commit 06f3687

File tree

8 files changed

+319
-310
lines changed

8 files changed

+319
-310
lines changed

src/main/java/io/r2dbc/mssql/ColumnSource.java

Lines changed: 0 additions & 163 deletions
This file was deleted.

src/main/java/io/r2dbc/mssql/EscapeAwareColumnMatcher.java renamed to src/main/java/io/r2dbc/mssql/EscapeAwareNameMatcher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
*
2727
* @author Mark Paluch
2828
*/
29-
final class EscapeAwareColumnMatcher {
29+
final class EscapeAwareNameMatcher {
3030

3131
@Nullable
32-
public static String findColumn(String name, Collection<String> names) {
32+
public static String find(String name, Collection<String> names) {
3333

3434
for (String s : names) {
3535
if (matches(name, s)) {

src/main/java/io/r2dbc/mssql/MssqlColumnMetadata.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package io.r2dbc.mssql;
1818

1919
import io.r2dbc.mssql.codec.Codecs;
20-
import io.r2dbc.mssql.message.token.Column;
20+
import io.r2dbc.mssql.codec.Decodable;
2121
import io.r2dbc.mssql.message.type.TypeInformation;
2222
import io.r2dbc.mssql.util.Assert;
2323
import io.r2dbc.spi.ColumnMetadata;
@@ -27,30 +27,30 @@
2727
import javax.annotation.Nonnull;
2828

2929
/**
30-
* Microsoft SQL Server-specific {@link ColumnMetadata} based on {@link Column}.
30+
* Microsoft SQL Server-specific {@link ColumnMetadata} based on {@link Decodable}.
3131
*
3232
* @author Mark Paluch
3333
*/
3434
public final class MssqlColumnMetadata implements ColumnMetadata {
3535

36-
private final Column column;
36+
private final Decodable decodable;
3737

3838
private final Codecs codecs;
3939

4040
/**
4141
* Creates a new {@link MssqlColumnMetadata}.
4242
*
43-
* @param column the column.
44-
* @param codecs the {@link Codecs codec registry}
43+
* @param decodable the column.
44+
* @param codecs the {@link Codecs codec registry}
4545
*/
46-
MssqlColumnMetadata(Column column, Codecs codecs) {
47-
this.column = Assert.requireNonNull(column, "Column must not be null");
46+
MssqlColumnMetadata(Decodable decodable, Codecs codecs) {
47+
this.decodable = Assert.requireNonNull(decodable, "Decodable must not be null");
4848
this.codecs = Assert.requireNonNull(codecs, "Codecs must not be null");
4949
}
5050

5151
@Override
5252
public String getName() {
53-
return this.column.getName();
53+
return this.decodable.getName();
5454
}
5555

5656
@Override
@@ -81,7 +81,7 @@ public Type getType() {
8181
@Override
8282
@Nonnull
8383
public TypeInformation getNativeTypeMetadata() {
84-
return this.column.getType();
84+
return this.decodable.getType();
8585
}
8686

8787
}

src/main/java/io/r2dbc/mssql/MssqlRow.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public <T> T get(int index, Class<T> type) {
9595
Assert.requireNonNull(type, "Type must not be null");
9696
requireNotReleased();
9797

98-
Column column = this.metadata.getColumn(index);
98+
Column column = this.metadata.get(index);
9999
return doGet(column, type);
100100
}
101101

@@ -106,7 +106,7 @@ public <T> T get(String name, Class<T> type) {
106106
Assert.requireNonNull(type, "Type must not be null");
107107
requireNotReleased();
108108

109-
Column column = this.metadata.getColumn(name);
109+
Column column = this.metadata.get(name);
110110
return doGet(column, type);
111111
}
112112

0 commit comments

Comments
 (0)