in cloud-spanner-r2dbc/src/main/java/com/google/cloud/spanner/r2dbc/v2/ClientLibraryDecoder.java [103:115]
private static <T> T readAndConvert(Struct struct, int index,
Map<Type, BiFunction<Struct, Integer, Object>> selectedCodecsMap, Class<T> type) {
Object value = selectedCodecsMap.get(struct.getColumnType(index)).apply(struct, index);
// need to convert to String to JsonWrapper when invoked from Spring Data with type =
// Object.class
if (struct.getColumnType(index) == Type.json()) {
return (T) SpannerClientLibraryConverters.convert(value, JsonWrapper.class);
}
if (type.isAssignableFrom(value.getClass())) {
return (T) value;
}
return SpannerClientLibraryConverters.convert(value, type);
}