@@ -114,7 +114,7 @@ private OracleR2dbcTypes() {}
114114 * name.
115115 * </p><p>
116116 * The {@code ArrayType} object returned by this method may be used to create
117- * a {@link Parameter} that binds an array value to a {@link Statement}.
117+ * a {@link Parameter} that binds an array value to a {@link Statement}:
118118 * </p><pre>{@code
119119 * Publisher<Result> arrayBindExample(Connection connection) {
120120 * Statement statement =
@@ -137,6 +137,39 @@ public static ArrayType arrayType(String name) {
137137 return new ArrayTypeImpl (Objects .requireNonNull (name , "name is null" ));
138138 }
139139
140+ /**
141+ * <p>
142+ * Creates an {@link ObjectType} representing a user defined {@code OBJECT}
143+ * type. The {@code name} passed to this method must identify the name of a
144+ * user defined {@code OBJECT} type.
145+ * </p><p>
146+ * Typically, the name passed to this method should be UPPER CASE, unless the
147+ * {@code CREATE TYPE} command that created the type used an "enquoted" type
148+ * name.
149+ * </p><p>
150+ * The {@code ObjectType} object returned by this method may be used to create
151+ * a {@link Parameter} that binds an OBJECT value to a {@link Statement}:
152+ * </p><pre>{@code
153+ * Publisher<Result> objectMapBindExample(Connection connection) {
154+ * Statement statement =
155+ * connection.createStatement("INSERT INTO petTable VALUES (:petObject)");
156+ *
157+ * // Bind the attributes of the PET OBJECT defined above
158+ * ObjectType objectType = OracleR2dbcTypes.objectType("PET");
159+ * Map<String,Object> attributeValues = Map.of(
160+ * "name", "Derby",
161+ * "species", "Dog",
162+ * "weight", 22.8,
163+ * "birthday", LocalDate.of(2015, 11, 07));
164+ * statement.bind("petObject", Parameters.in(objectType, attributeValues));
165+ *
166+ * return statement.execute();
167+ * }
168+ * }</pre>
169+ * @param name Name of a user defined OBJECT type. Not null.
170+ * @return A {@code Type} object representing the user defined OBJECT type.
171+ * Not null.
172+ */
140173 public static ObjectType objectType (String name ) {
141174 return new ObjectTypeImpl (Objects .requireNonNull (name , "name is null" ));
142175 }
@@ -183,25 +216,32 @@ public interface ArrayType extends Type {
183216 String getName ();
184217 }
185218
219+ /**
220+ * Extension of the standard {@link Type} interface used to represent user
221+ * defined OBJECT types. An instance of {@code ObjectType} must be used when
222+ * binding an OBJECT value to a {@link Statement} created by the Oracle R2DBC
223+ * Driver.
224+ */
186225 public interface ObjectType extends Type {
187226
188227 /**
189228 * {@inheritDoc}
190- * Returns {@code Object[].class}, which is the standard mapping for
191- * {@link R2dbcType#COLLECTION}. The true default type mapping is the array
192- * variant of the default mapping for the element type of the {@code ARRAY}.
193- * For instance, an {@code ARRAY} of {@code VARCHAR} maps to a
194- * {@code String[]} by default.
229+ * Returns the class of {@link OracleR2dbcObject}, which is the default mapping
230+ * of OBJECT types returned by Oracle R2DBC.
195231 */
196232 @ Override
197233 Class <?> getJavaType ();
198234
199235 /**
200236 * {@inheritDoc}
201- * Returns the name of this user defined {@code ARRAY } type. For instance,
202- * this method returns "MY_ARRAY " if the type is declared as:
237+ * Returns the name of this user defined {@code OBJECT } type. For instance,
238+ * this method returns "PET " if the type is declared as:
203239 * <pre>{@code
204- * CREATE TYPE MY_ARRAY AS ARRAY(8) OF NUMBER
240+ * CREATE TYPE PET AS OBJECT(
241+ * name VARCHAR(128),
242+ * species VARCHAR(128),
243+ * weight NUMBER,
244+ * birthday DATE)
205245 * }</pre>
206246 */
207247 @ Override
0 commit comments