@@ -103,6 +103,12 @@ private OracleR2dbcTypes() {}
103
103
public static final Type REF_CURSOR =
104
104
new TypeImpl (Result .class , "SYS_REFCURSOR" );
105
105
106
+ /**
107
+ * A user defined OBJECT type.
108
+ */
109
+ public static final Type OBJECT =
110
+ new TypeImpl (OracleR2dbcObject .class , "OBJECT" );
111
+
106
112
/**
107
113
* <p>
108
114
* Creates an {@link ArrayType} representing a user defined {@code ARRAY}
@@ -137,6 +143,10 @@ public static ArrayType arrayType(String name) {
137
143
return new ArrayTypeImpl (Objects .requireNonNull (name , "name is null" ));
138
144
}
139
145
146
+ public static ObjectType objectType (String name ) {
147
+ return new ObjectTypeImpl (Objects .requireNonNull (name , "name is null" ));
148
+ }
149
+
140
150
/**
141
151
* Extension of the standard {@link Type} interface used to represent user
142
152
* defined ARRAY types. An instance of {@code ArrayType} must be used when
@@ -179,6 +189,31 @@ public interface ArrayType extends Type {
179
189
String getName ();
180
190
}
181
191
192
+ public interface ObjectType extends Type {
193
+
194
+ /**
195
+ * {@inheritDoc}
196
+ * Returns {@code Object[].class}, which is the standard mapping for
197
+ * {@link R2dbcType#COLLECTION}. The true default type mapping is the array
198
+ * variant of the default mapping for the element type of the {@code ARRAY}.
199
+ * For instance, an {@code ARRAY} of {@code VARCHAR} maps to a
200
+ * {@code String[]} by default.
201
+ */
202
+ @ Override
203
+ Class <?> getJavaType ();
204
+
205
+ /**
206
+ * {@inheritDoc}
207
+ * Returns the name of this user defined {@code ARRAY} type. For instance,
208
+ * this method returns "MY_ARRAY" if the type is declared as:
209
+ * <pre>{@code
210
+ * CREATE TYPE MY_ARRAY AS ARRAY(8) OF NUMBER
211
+ * }</pre>
212
+ */
213
+ @ Override
214
+ String getName ();
215
+ }
216
+
182
217
/** Concrete implementation of the {@code ArrayType} interface */
183
218
private static final class ArrayTypeImpl
184
219
extends TypeImpl implements ArrayType {
@@ -195,6 +230,23 @@ private static final class ArrayTypeImpl
195
230
}
196
231
}
197
232
233
+ /** Concrete implementation of the {@code ObjectType} interface */
234
+ private static final class ObjectTypeImpl
235
+ extends TypeImpl implements ObjectType {
236
+
237
+ /**
238
+ * Constructs an ARRAY type with the given {@code name}. The constructed
239
+ * {@code ObjectType} as a default Java type mapping of
240
+ * {@code Object[].class}. This is consistent with the standard
241
+ * {@link R2dbcType#COLLECTION} type.
242
+ * @param name User defined name of the type. Not null.
243
+ */
244
+ ObjectTypeImpl (String name ) {
245
+ // TODO: Consider defining Readable.class as the default type mapping.
246
+ super (Object .class , name );
247
+ }
248
+ }
249
+
198
250
/**
199
251
* Implementation of the {@link Type} SPI.
200
252
*/
0 commit comments