diff --git a/jOOQ-tools/src/org/jooq/xtend/Rows.xtend b/jOOQ-tools/src/org/jooq/xtend/Rows.xtend index c7c52db48f..a782aafbc0 100644 --- a/jOOQ-tools/src/org/jooq/xtend/Rows.xtend +++ b/jOOQ-tools/src/org/jooq/xtend/Rows.xtend @@ -1257,6 +1257,16 @@ class Rows extends Generators { return result; } + @Override + public final Class type(int fieldIndex) { + return fieldIndex >= 0 && fieldIndex < size() ? fields.field(fieldIndex).getType() : null; + } + + @Override + public final Class type(String fieldName) { + return type(indexOf(fieldName)); + } + @Override public final DataType[] dataTypes() { int size = fields.size(); @@ -1268,6 +1278,16 @@ class Rows extends Generators { return result; } + + @Override + public final DataType dataType(int fieldIndex) { + return fieldIndex >= 0 && fieldIndex < size() ? fields.field(fieldIndex).getDataType() : null; + } + + @Override + public final DataType dataType(String fieldName) { + return dataType(indexOf(fieldName)); + } «FOR degree : (1..Constants::MAX_ROW_DEGREE)» @Override diff --git a/jOOQ/src/main/java/org/jooq/Row.java b/jOOQ/src/main/java/org/jooq/Row.java index 828bff344a..ddc2f89902 100644 --- a/jOOQ/src/main/java/org/jooq/Row.java +++ b/jOOQ/src/main/java/org/jooq/Row.java @@ -66,18 +66,18 @@ public interface Row extends QueryPart, Iterable> { /** * Get a specific field from this row. * - * @param name The field to fetch + * @param fieldName The field to fetch * @return The field with the given name */ - Field field(String name); + Field field(String fieldName); /** * Get a specific field from this row. * - * @param index The field's index of the field to fetch + * @param fieldIndex The field's index of the field to fetch * @return The field with the given name */ - Field field(int index); + Field field(int fieldIndex); /** * Get all fields from this row. @@ -112,6 +112,22 @@ public interface Row extends QueryPart, Iterable> { */ Class[] types(); + /** + * Get the type for a given field index + * + * @param fieldIndex The field's index of the field's type to fetch + * @return The field's type + */ + Class type(int fieldIndex); + + /** + * Get the type for a given field name + * + * @param fieldName The field's name of the field's type to fetch + * @return The field's type + */ + Class type(String fieldName); + /** * Get an array of data types for this row. *

@@ -120,6 +136,22 @@ public interface Row extends QueryPart, Iterable> { */ DataType[] dataTypes(); + /** + * Get the data type for a given field index + * + * @param fieldIndex The field's index of the field's data type to fetch + * @return The field's data type + */ + DataType dataType(int fieldIndex); + + /** + * Get the data type for a given field name + * + * @param fieldName The field's name of the field's data type to fetch + * @return The field's data type + */ + DataType dataType(String fieldName); + // ------------------------------------------------------------------------ // [NOT] NULL predicates // ------------------------------------------------------------------------ diff --git a/jOOQ/src/main/java/org/jooq/impl/RowImpl.java b/jOOQ/src/main/java/org/jooq/impl/RowImpl.java index 66b20774d9..f95c57bf8d 100644 --- a/jOOQ/src/main/java/org/jooq/impl/RowImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/RowImpl.java @@ -251,6 +251,16 @@ implements return result; } + @Override + public final Class type(int fieldIndex) { + return fieldIndex >= 0 && fieldIndex < size() ? fields.field(fieldIndex).getType() : null; + } + + @Override + public final Class type(String fieldName) { + return type(indexOf(fieldName)); + } + @Override public final DataType[] dataTypes() { int size = fields.size(); @@ -263,6 +273,16 @@ implements return result; } + @Override + public final DataType dataType(int fieldIndex) { + return fieldIndex >= 0 && fieldIndex < size() ? fields.field(fieldIndex).getDataType() : null; + } + + @Override + public final DataType dataType(String fieldName) { + return dataType(indexOf(fieldName)); + } + @Override public final Field field1() { return (Field) fields.field(0);