Skip to content

Commit 4fa302c

Browse files
committed
Allow returning PostgresTypeIdentifier subtypes from CodecMetadata.
[resolves #600] Signed-off-by: Mark Paluch <[email protected]>
1 parent fd7d24c commit 4fa302c

File tree

7 files changed

+10
-12
lines changed

7 files changed

+10
-12
lines changed

src/main/java/io/r2dbc/postgresql/codec/AbstractJsonCodec.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import java.util.EnumSet;
2424
import java.util.Set;
25-
import java.util.stream.Collectors;
2625

2726
import static io.r2dbc.postgresql.codec.PostgresqlObjectId.JSON;
2827
import static io.r2dbc.postgresql.codec.PostgresqlObjectId.JSONB;
@@ -55,8 +54,8 @@ boolean doCanDecode(PostgresqlObjectId type, Format format) {
5554
}
5655

5756
@Override
58-
public Iterable<PostgresTypeIdentifier> getDataTypes() {
59-
return SUPPORTED_TYPES.stream().map(PostgresTypeIdentifier.class::cast).collect(Collectors.toList());
57+
public Iterable<? extends PostgresTypeIdentifier> getDataTypes() {
58+
return SUPPORTED_TYPES;
6059
}
6160

6261
}

src/main/java/io/r2dbc/postgresql/codec/AbstractNumericCodec.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import java.util.EnumSet;
2828
import java.util.Set;
2929
import java.util.function.Function;
30-
import java.util.stream.Collectors;
3130

3231
import static io.r2dbc.postgresql.codec.PostgresqlObjectId.FLOAT4;
3332
import static io.r2dbc.postgresql.codec.PostgresqlObjectId.FLOAT8;
@@ -146,8 +145,8 @@ public EncodedParameter encodeNull() {
146145
}
147146

148147
@Override
149-
public Iterable<PostgresTypeIdentifier> getDataTypes() {
150-
return SUPPORTED_TYPES.stream().map(PostgresTypeIdentifier.class::cast).collect(Collectors.toList());
148+
public Iterable<? extends PostgresTypeIdentifier> getDataTypes() {
149+
return SUPPORTED_TYPES;
151150
}
152151

153152
/**

src/main/java/io/r2dbc/postgresql/codec/ByteCodec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public Iterable<Format> getFormats() {
8484
}
8585

8686
@Override
87-
public Iterable<PostgresTypeIdentifier> getDataTypes() {
87+
public Iterable<? extends PostgresTypeIdentifier> getDataTypes() {
8888
return this.delegate.getDataTypes();
8989
}
9090

src/main/java/io/r2dbc/postgresql/codec/CharacterCodec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public Iterable<Format> getFormats() {
8686
}
8787

8888
@Override
89-
public Iterable<PostgresTypeIdentifier> getDataTypes() {
89+
public Iterable<? extends PostgresTypeIdentifier> getDataTypes() {
9090
return this.delegate.getDataTypes();
9191
}
9292

src/main/java/io/r2dbc/postgresql/codec/CodecMetadata.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ default Iterable<Format> getFormats() {
5050
*
5151
* @return the datatypes
5252
*/
53-
Iterable<PostgresTypeIdentifier> getDataTypes();
53+
Iterable<? extends PostgresTypeIdentifier> getDataTypes();
5454

5555
}

src/main/java/io/r2dbc/postgresql/codec/StringCodec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ public PostgresTypeIdentifier getArrayDataType() {
109109
}
110110

111111
@Override
112-
public Iterable<PostgresTypeIdentifier> getDataTypes() {
113-
return Stream.concat(Stream.of(this.defaultType), SUPPORTED_TYPES.stream()).map(PostgresTypeIdentifier.class::cast).collect(Collectors.toSet());
112+
public Iterable<? extends PostgresTypeIdentifier> getDataTypes() {
113+
return Stream.concat(Stream.of(this.defaultType), SUPPORTED_TYPES.stream()).collect(Collectors.toSet());
114114
}
115115

116116
private static class StringDecoder implements Codec<String>, Decoder<String> {

src/main/java/io/r2dbc/postgresql/codec/StringCodecDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public Iterable<Format> getFormats() {
9999
}
100100

101101
@Override
102-
public Iterable<PostgresTypeIdentifier> getDataTypes() {
102+
public Iterable<? extends PostgresTypeIdentifier> getDataTypes() {
103103
return this.delegate.getDataTypes();
104104
}
105105

0 commit comments

Comments
 (0)