[jOOQ/jOOQ#7100] Add Field.convert() convenience methods

This commit includes a variety of improvements:

- The new Field.convert() convenience methods
- [jOOQ/jOOQ#11812] Row <: SelectField
- [jOOQ/jOOQ#11817] New Converter and DataType methods
This commit is contained in:
Lukas Eder 2021-04-29 11:06:01 +02:00
parent 2eb721e576
commit fc97b32a09
98 changed files with 535 additions and 380 deletions

View File

@ -37,9 +37,12 @@
*/
package org.jooq;
import static org.jooq.Converters.nullable;
import java.io.Serializable;
import java.util.function.Function;
import org.jooq.exception.DataTypeException;
import org.jooq.impl.AbstractConverter;
import org.jooq.impl.SQLDataType;
@ -53,9 +56,11 @@ import org.jetbrains.annotations.NotNull;
* directed, this means that the <code>Converter</code> is used
* <ul>
* <li>to load database types converting them to user types "FROM" the database.
* Hence, {@link #fromType()} is the type as defined in the database.</li>
* Hence, {@link #fromType()} is the type as defined in the database. Think of
* "FROM" = "reading".</li>
* <li>to store user types converting them to database types "TO" the database.
* Hence, {@link #toType()} is the user-defined type</li>
* Think of "TO" = "writing". Hence, {@link #toType()} is the user-defined
* type</li>
* </ul>
* <p>
* Note: In order to avoid unwanted side-effects, it is highly recommended (yet
@ -83,7 +88,8 @@ import org.jetbrains.annotations.NotNull;
* {@link DataType#asConvertedDataType(Binding)}, for example. Custom data types
* can also be defined on generated code using the
* <code>&lt;forcedType/&gt;</code> configuration, see <a href=
* "https://www.jooq.org/doc/latest/manual/code-generation/codegen-advanced/codegen-config-database/codegen-database-forced-types/">the manual for more details</a>
* "https://www.jooq.org/doc/latest/manual/code-generation/codegen-advanced/codegen-config-database/codegen-database-forced-types/">the
* manual for more details</a>
*
* @author Lukas Eder
* @param <T> The database type - i.e. any type available from
@ -93,29 +99,29 @@ import org.jetbrains.annotations.NotNull;
public interface Converter<T, U> extends Serializable {
/**
* Convert a database object to a user object
* Read and convert a database object to a user object.
*
* @param databaseObject The database object
* @return The user object
* @param databaseObject The database object.
* @return The user object.
*/
U from(T databaseObject);
/**
* Convert a user object to a database object
* Convert and write a user object to a database object.
*
* @param userObject The user object
* @return The database object
* @param userObject The user object.
* @return The database object.
*/
T to(U userObject);
/**
* The database type
* The database type.
*/
@NotNull
Class<T> fromType();
/**
* The user type
* The user type.
*/
@NotNull
Class<U> toType();
@ -147,12 +153,13 @@ public interface Converter<T, U> extends Serializable {
/**
* Construct a new converter from functions.
*
* @param <T> the database type
* @param <U> the user type
* @param fromType The database type
* @param toType The user type
* @param from A function converting from T to U
* @param to A function converting from U to T
* @param <T> the database type.
* @param <U> the user type.
* @param fromType The database type.
* @param toType The user type.
* @param from A function converting from T to U when reading from the
* database.
* @param to A function converting from U to T when writing to the database.
* @return The converter.
* @see Converter
*/
@ -182,6 +189,50 @@ public interface Converter<T, U> extends Serializable {
};
}
/**
* Construct a new read-only converter from a function.
*
* @param <T> the database type
* @param <U> the user type
* @param fromType The database type
* @param toType The user type
* @param from A function converting from T to U when reading from the
* database.
* @param to A function converting from U to T when writing to the database.
* @return The converter.
* @see Converter
*/
@NotNull
static <T, U> Converter<T, U> from(
Class<T> fromType,
Class<U> toType,
Function<? super T, ? extends U> from
) {
return of(fromType, toType, from, notImplemented());
}
/**
* Construct a new write-only converter from a function.
*
* @param <T> the database type
* @param <U> the user type
* @param fromType The database type
* @param toType The user type
* @param from A function converting from T to U when reading from the
* database.
* @param to A function converting from U to T when writing to the database.
* @return The converter.
* @see Converter
*/
@NotNull
static <T, U> Converter<T, U> to(
Class<T> fromType,
Class<U> toType,
Function<? super U, ? extends T> to
) {
return of(fromType, toType, notImplemented(), to);
}
/**
* Construct a new converter from functions.
* <p>
@ -205,12 +256,12 @@ public interface Converter<T, U> extends Serializable {
* @param <U> the user type
* @param fromType The database type
* @param toType The user type
* @param from A function converting from T to U
* @param to A function converting from U to T
* @param from A function converting from T to U when reading from the
* database.
* @param to A function converting from U to T when writing to the database.
* @return The converter.
* @see Converter
*/
@SuppressWarnings("unchecked")
@NotNull
static <T, U> Converter<T, U> ofNullable(
Class<T> fromType,
@ -218,19 +269,79 @@ public interface Converter<T, U> extends Serializable {
Function<? super T, ? extends U> from,
Function<? super U, ? extends T> to
) {
Function<T, U> fromS;
Function<U, T> toS;
return of(fromType, toType, nullable(from), nullable(to));
}
if (from instanceof Serializable)
fromS = (Function<T, U> & Serializable) t -> t == null ? null : from.apply(t);
else
fromS = t -> t == null ? null : from.apply(t);
/**
* Construct a new read-only converter from a function.
* <p>
* This works like {@link Converter#from(Class, Class, Function)}, except
* that the conversion {@link Function} is decorated with a function that
* always returns <code>null</code> for <code>null</code> inputs.
* <p>
* Example:
* <p>
* <code><pre>
* Converter&lt;String, Integer&gt; converter =
* Converter.fromNullable(String.class, Integer.class, Integer::parseInt);
*
* // No exceptions thrown
* assertNull(converter.from(null));
* </pre></code>
*
* @param <T> the database type.
* @param <U> the user type.
* @param fromType The database type.
* @param toType The user type.
* @param from A function converting from T to U when reading from the
* database.
* @return The converter.
* @see Converter
*/
@NotNull
static <T, U> Converter<T, U> fromNullable(
Class<T> fromType,
Class<U> toType,
Function<? super T, ? extends U> from
) {
return of(fromType, toType, nullable(from), notImplemented());
}
if (to instanceof Serializable)
toS = (Function<U, T> & Serializable) u -> u == null ? null : to.apply(u);
else
toS = u -> u == null ? null : to.apply(u);
/**
* Construct a new write-only converter from a function.
* <p>
* This works like {@link Converter#to(Class, Class, Function)}, except that
* the conversion {@link Function} is decorated with a function that always
* returns <code>null</code> for <code>null</code> inputs.
* <p>
* Example:
* <p>
* <code><pre>
* Converter&lt;String, Integer&gt; converter =
* Converter.toNullable(String.class, Integer.class, Object::toString);
*
* // No exceptions thrown
* assertNull(converter.to(null));
* </pre></code>
*
* @param <T> the database type
* @param <U> the user type
* @param fromType The database type
* @param toType The user type
* @param to A function converting from U to T when writing to the database.
* @return The converter.
* @see Converter
*/
@NotNull
static <T, U> Converter<T, U> toNullable(
Class<T> fromType,
Class<U> toType,
Function<? super U, ? extends T> to
) {
return of(fromType, toType, notImplemented(), nullable(to));
}
return of(fromType, toType, fromS, toS);
private static <T, U> Function<T, U> notImplemented() {
return t -> { throw new DataTypeException("Conversion function not implemented"); };
}
}

View File

@ -40,6 +40,9 @@ package org.jooq;
import static org.jooq.impl.Internal.arrayType;
import static org.jooq.tools.Convert.convertArray;
import java.io.Serializable;
import java.util.function.Function;
import org.jooq.impl.AbstractConverter;
import org.jooq.impl.IdentityConverter;
import org.jooq.impl.SQLDataType;
@ -216,4 +219,10 @@ public class Converters<T, U> extends AbstractConverter<T, U> {
sb.append(" ]");
return sb.toString();
}
static final <T, U> Function<T, U> nullable(Function<? super T, ? extends U> f) {
return f instanceof Serializable
? (Function<T, U> & Serializable) t -> t == null ? null
: f.apply(t) : t -> t == null ? null : f.apply(t);
}
}

View File

@ -74,6 +74,7 @@ import java.util.List;
import java.util.function.Function;
import org.jooq.exception.DataTypeException;
import org.jooq.exception.MappingException;
import org.jooq.impl.SQLDataType;
import org.jooq.tools.Convert;
import org.jooq.types.DayToSecond;
@ -207,6 +208,30 @@ public interface DataType<T> extends Named {
return asConvertedDataType(Converter.of(getType(), toType, from, to));
}
/**
* Convenience method for converting this type to a read-only type using
* {@link Converter#from(Class, Class, Function)}.
*/
@NotNull
default <U> DataType<U> asConvertedDataTypeFrom(
Class<U> toType,
Function<? super T, ? extends U> from
) {
return asConvertedDataType(Converter.from(getType(), toType, from));
}
/**
* Convenience method for converting this type to a write-only type using
* {@link Converter#to(Class, Class, Function)}.
*/
@NotNull
default <U> DataType<U> asConvertedDataTypeTo(
Class<U> toType,
Function<? super U, ? extends T> to
) {
return asConvertedDataType(Converter.to(getType(), toType, to));
}
/**
* Retrieve the data type for a given binding.
*/

View File

@ -204,32 +204,38 @@ extends
);
/**
* The name of the field.
* Apply an ad-hoc read-only data type {@link Converter} to this field
* expression.
* <p>
* The name is any of these:
* <ul>
* <li>The formal name of the field, if it is a <i>physical table/view
* field</i></li>
* <li>The alias of an <i>aliased field</i></li>
* <li>A generated / unspecified value for any other <i>expression</i></li>
* <li>The name of a parameter if it is a named {@link Param}</li>
* </ul>
* Rather than attaching data type converters at code generation time, or
* creating cumbersome expressions using
* {@link DataType#asConvertedDataTypeFrom(Class, Function)}, this method
* allows for creating a derived field expression with an ad-hoc data type
* converter for single query usage.
*
* @param <U> The user type.
* @param converter The read-only converter to be applied on any operations
* using this field.
* @return A derived field expression using a new converter.
*/
@NotNull
@Override
String getName();
<U> Field<U> convertFrom(Class<U> toType, Function<? super T, ? extends U> from);
/**
* The comment given to the field.
* Apply an ad-hoc write-only data type {@link Converter} to this field
* expression.
* <p>
* If this <code>Field</code> is a generated field from your database, it
* may provide its DDL comment through this method. All other column
* expressions return the empty string <code>""</code> here, never
* <code>null</code>.
* Rather than attaching data type converters at code generation time, or
* creating cumbersome expressions using
* {@link DataType#asConvertedDataTypeTo(Class, Function)}, this method
* allows for creating a derived field expression with an ad-hoc data type
* converter for single query usage.
*
* @param <U> The user type.
* @param converter The write-only converter to be applied on any operations
* using this field.
* @return A derived field expression using a new converter.
*/
@NotNull
@Override
String getComment();
<U> Field<U> convertTo(Class<U> toType, Function<? super U, ? extends T> to);
/**
* Create an alias for this field.
@ -273,6 +279,34 @@ extends
@Support
Field<T> as(Field<?> otherField);
/**
* The name of the field.
* <p>
* The name is any of these:
* <ul>
* <li>The formal name of the field, if it is a <i>physical table/view
* field</i></li>
* <li>The alias of an <i>aliased field</i></li>
* <li>A generated / unspecified value for any other <i>expression</i></li>
* <li>The name of a parameter if it is a named {@link Param}</li>
* </ul>
*/
@NotNull
@Override
String getName();
/**
* The comment given to the field.
* <p>
* If this <code>Field</code> is a generated field from your database, it
* may provide its DDL comment through this method. All other column
* expressions return the empty string <code>""</code> here, never
* <code>null</code>.
*/
@NotNull
@Override
String getComment();
/**
* Create an alias for this field.
* <p>

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row1<T1> extends Row {
public interface Row1<T1> extends Row, SelectField<Record1<T1>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> extends Row {
public interface Row10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> extends Row, SelectField<Record10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> extends Row {
public interface Row11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> extends Row, SelectField<Record11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> extends Row {
public interface Row12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> extends Row, SelectField<Record12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> extends Row {
public interface Row13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> extends Row, SelectField<Record13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> extends Row {
public interface Row14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> extends Row, SelectField<Record14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> extends Row {
public interface Row15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> extends Row, SelectField<Record15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> extends Row {
public interface Row16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> extends Row, SelectField<Record16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> extends Row {
public interface Row17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> extends Row, SelectField<Record17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> extends Row {
public interface Row18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> extends Row, SelectField<Record18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> extends Row {
public interface Row19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> extends Row, SelectField<Record19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row2<T1, T2> extends Row {
public interface Row2<T1, T2> extends Row, SelectField<Record2<T1, T2>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> extends Row {
public interface Row20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> extends Row, SelectField<Record20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> extends Row {
public interface Row21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> extends Row, SelectField<Record21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> extends Row {
public interface Row22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> extends Row, SelectField<Record22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row3<T1, T2, T3> extends Row {
public interface Row3<T1, T2, T3> extends Row, SelectField<Record3<T1, T2, T3>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row4<T1, T2, T3, T4> extends Row {
public interface Row4<T1, T2, T3, T4> extends Row, SelectField<Record4<T1, T2, T3, T4>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row5<T1, T2, T3, T4, T5> extends Row {
public interface Row5<T1, T2, T3, T4, T5> extends Row, SelectField<Record5<T1, T2, T3, T4, T5>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row6<T1, T2, T3, T4, T5, T6> extends Row {
public interface Row6<T1, T2, T3, T4, T5, T6> extends Row, SelectField<Record6<T1, T2, T3, T4, T5, T6>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row7<T1, T2, T3, T4, T5, T6, T7> extends Row {
public interface Row7<T1, T2, T3, T4, T5, T6, T7> extends Row, SelectField<Record7<T1, T2, T3, T4, T5, T6, T7>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row8<T1, T2, T3, T4, T5, T6, T7, T8> extends Row {
public interface Row8<T1, T2, T3, T4, T5, T6, T7, T8> extends Row, SelectField<Record8<T1, T2, T3, T4, T5, T6, T7, T8>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface Row9<T1, T2, T3, T4, T5, T6, T7, T8, T9> extends Row {
public interface Row9<T1, T2, T3, T4, T5, T6, T7, T8, T9> extends Row, SelectField<Record9<T1, T2, T3, T4, T5, T6, T7, T8, T9>> {
// ------------------------------------------------------------------------
// Field accessors

View File

@ -83,7 +83,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author Lukas Eder
*/
public interface RowN extends Row {
public interface RowN extends Row, SelectField<Record> {
// ------------------------------------------------------------------------
// Generic comparison predicates

View File

@ -38,7 +38,6 @@
package org.jooq;
/**
* A <code>QueryPart</code> to be used exclusively in <code>SELECT</code>
* clauses.

View File

@ -63,7 +63,7 @@ abstract class AbstractCursor<R extends Record> extends AbstractResult<R> implem
*/
private static final long serialVersionUID = 866689823212695960L;
AbstractCursor(Configuration configuration, AbstractRow row) {
AbstractCursor(Configuration configuration, AbstractRow<R> row) {
super(configuration, row);
}

View File

@ -1241,7 +1241,7 @@ abstract class AbstractDMLQuery<R extends Record> extends AbstractRowCountQuery
// Only the IDENTITY value was requested. No need for an
// additional query
if (returningResolvedAsterisks.size() == 1 && new FieldsImpl<>(returningResolvedAsterisks).field(returnIdentity) != null) {
AbstractRow fields = Tools.row0(returningResolvedAsterisks.toArray(EMPTY_FIELD));
AbstractRow<? extends AbstractRecord> fields = (AbstractRow<AbstractRecord>) Tools.row0(returningResolvedAsterisks.toArray(EMPTY_FIELD));
for (final Object id : ids) {
((Result) getResult()).add(

View File

@ -188,12 +188,12 @@ abstract class AbstractField<T> extends AbstractTypedNamed<T> implements Field<T
@Override
public final <U> Field<U> convert(Binding<T, U> binding) {
return CustomField.of(getQualifiedName(), getDataType().asConvertedDataType(binding), c -> c.visit(this));
return coerce(getDataType().asConvertedDataType(binding));
}
@Override
public final <U> Field<U> convert(Converter<T, U> converter) {
return CustomField.of(getQualifiedName(), getDataType().asConvertedDataType(converter), c -> c.visit(this));
return coerce(getDataType().asConvertedDataType(converter));
}
@Override
@ -202,7 +202,17 @@ abstract class AbstractField<T> extends AbstractTypedNamed<T> implements Field<T
Function<? super T, ? extends U> from,
Function<? super U, ? extends T> to
) {
return CustomField.of(getQualifiedName(), getDataType().asConvertedDataType(toType, from, to), c -> c.visit(this));
return coerce(getDataType().asConvertedDataType(toType, from, to));
}
@Override
public final <U> Field<U> convertFrom(Class<U> toType, Function<? super T, ? extends U> from) {
return coerce(getDataType().asConvertedDataTypeFrom(toType, from));
}
@Override
public final <U> Field<U> convertTo(Class<U> toType, Function<? super U, ? extends T> to) {
return coerce(getDataType().asConvertedDataTypeTo(toType, to));
}
@Override

View File

@ -120,14 +120,14 @@ abstract class AbstractRecord extends AbstractStore implements Record {
/**
* Generated UID
*/
private static final long serialVersionUID = -6052512608911220404L;
private static final JooqLogger log = JooqLogger.getLogger(AbstractRecord.class);
private static final long serialVersionUID = -6052512608911220404L;
private static final JooqLogger log = JooqLogger.getLogger(AbstractRecord.class);
final AbstractRow fields;
final Object[] values;
final Object[] originals;
final BitSet changed;
boolean fetched;
final AbstractRow<? extends AbstractRecord> fields;
final Object[] values;
final Object[] originals;
final BitSet changed;
boolean fetched;
/**
* @deprecated - 3.14.5 - [#8495] [#11058] - Re-use AbstractRow reference if possible
@ -145,10 +145,10 @@ abstract class AbstractRecord extends AbstractStore implements Record {
this(Tools.row0(fields));
}
AbstractRecord(AbstractRow fields) {
AbstractRecord(AbstractRow<?> fields) {
int size = fields.size();
this.fields = fields;
this.fields = (AbstractRow<? extends AbstractRecord>) fields;
this.values = new Object[size];
this.originals = new Object[size];
this.changed = new BitSet(size);
@ -843,7 +843,7 @@ abstract class AbstractRecord extends AbstractStore implements Record {
}
final <R extends Record> R intoRecord(Class<R> type) {
return Tools.newRecord(fetched, type, fields, configuration()).operate(new TransferRecordState<>(null));
return (R) Tools.newRecord(fetched, type, fields, configuration()).operate(new TransferRecordState<>(null));
}
private class TransferRecordState<R extends Record> implements ThrowingFunction<R, R, MappingException> {

View File

@ -120,10 +120,10 @@ abstract class AbstractResult<R extends Record> extends AbstractFormattable impl
*/
private static final long serialVersionUID = -3412555195899758746L;
final AbstractRow fields;
final AbstractRow<R> fields;
Configuration configuration;
AbstractResult(Configuration configuration, AbstractRow row) {
AbstractResult(Configuration configuration, AbstractRow<R> row) {
this.configuration = configuration;
this.fields = row;
}
@ -132,9 +132,8 @@ abstract class AbstractResult<R extends Record> extends AbstractFormattable impl
// XXX: RecordType API of subtypes
// -------------------------------------------------------------------------
@SuppressWarnings("unchecked")
public final RecordType<R> recordType() {
return (RecordType<R>) fields.fields;
return fields.fields;
}
@Override
@ -800,7 +799,13 @@ abstract class AbstractResult<R extends Record> extends AbstractFormattable impl
}
}
static final void formatJSONMap0(Record record, AbstractRow fields, JSONFormat format, int recordLevel, Writer writer) throws java.io.IOException {
static final void formatJSONMap0(
Record record,
AbstractRow<?> fields,
JSONFormat format,
int recordLevel,
Writer writer
) throws java.io.IOException {
String separator = "";
int size = fields.size();
boolean wrapRecords = format.wrapSingleColumnRecords() || size > 1;
@ -836,7 +841,13 @@ abstract class AbstractResult<R extends Record> extends AbstractFormattable impl
writer.append('}');
}
static final void formatJSONArray0(Record record, AbstractRow fields, JSONFormat format, int recordLevel, Writer writer) throws java.io.IOException {
static final void formatJSONArray0(
Record record,
AbstractRow<?> fields,
JSONFormat format,
int recordLevel,
Writer writer
) throws java.io.IOException {
String separator = "";
int size = fields.size();
@ -936,7 +947,7 @@ abstract class AbstractResult<R extends Record> extends AbstractFormattable impl
XMLFormat format,
int recordLevel,
Record record,
AbstractRow fields
AbstractRow<?> fields
)
throws java.io.IOException {
String newline = format.newline();

View File

@ -60,27 +60,6 @@ import org.jooq.Field;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Record1;
import org.jooq.Record10;
import org.jooq.Record11;
import org.jooq.Record12;
import org.jooq.Record13;
import org.jooq.Record14;
import org.jooq.Record15;
import org.jooq.Record16;
import org.jooq.Record17;
import org.jooq.Record18;
import org.jooq.Record19;
import org.jooq.Record2;
import org.jooq.Record20;
import org.jooq.Record21;
import org.jooq.Record22;
import org.jooq.Record3;
import org.jooq.Record4;
import org.jooq.Record5;
import org.jooq.Record6;
import org.jooq.Record7;
import org.jooq.Record8;
import org.jooq.Record9;
import org.jooq.Result;
import org.jooq.ResultQuery;
import org.jooq.Results;

View File

@ -43,23 +43,30 @@ import static org.jooq.impl.Keywords.K_ROW;
import static org.jooq.impl.QueryPartListView.wrap;
import java.util.Collection;
import java.util.function.Function;
import java.util.stream.Stream;
import org.jooq.Binding;
import org.jooq.Clause;
import org.jooq.Comment;
import org.jooq.Condition;
import org.jooq.Configuration;
import org.jooq.Context;
import org.jooq.Converter;
import org.jooq.DataType;
import org.jooq.Field;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Row;
import org.jooq.Row1;
import org.jooq.Row2;
import org.jooq.SelectField;
/**
* A common base class for the various degrees of {@link Row1}, {@link Row2},
* etc.
*/
abstract class AbstractRow extends AbstractQueryPart implements Row {
abstract class AbstractRow<R extends Record> extends AbstractQueryPart implements Row, SelectField<R> {
/**
* Generated UID
@ -67,7 +74,7 @@ abstract class AbstractRow extends AbstractQueryPart implements Row {
private static final long serialVersionUID = 2175082265665049629L;
private static final Clause[] CLAUSES = { FIELD_ROW };
final FieldsImpl<?> fields;
final FieldsImpl<R> fields;
AbstractRow(Field<?>... fields) {
this(new FieldsImpl<>(fields));
@ -77,12 +84,70 @@ abstract class AbstractRow extends AbstractQueryPart implements Row {
this(new FieldsImpl<>(fields));
}
AbstractRow(FieldsImpl<?> fields) {
AbstractRow(FieldsImpl<R> fields) {
super();
this.fields = fields;
}
// ------------------------------------------------------------------------
// XXX: SelectField API
// ------------------------------------------------------------------------
private final RowField<Row, R> rf() {
return new RowField<Row, R>(this);
}
@Override
public Converter<?, R> getConverter() {
return rf().getConverter();
}
@Override
public Binding<?, R> getBinding() {
return rf().getBinding();
}
@Override
public Class<R> getType() {
return rf().getType();
}
@Override
public DataType<R> getDataType() {
return rf().getDataType();
}
@Override
public DataType<R> getDataType(Configuration configuration) {
return rf().getDataType(configuration);
}
@Override
public String getName() {
return rf().getName();
}
@Override
public Name getQualifiedName() {
return rf().getQualifiedName();
}
@Override
public Name getUnqualifiedName() {
return rf().getUnqualifiedName();
}
@Override
public String getComment() {
return rf().getComment();
}
@Override
public Comment getCommentPart() {
return rf().getCommentPart();
}
/**
* [#8517] Convert the bind values in this row to the types of columns of another row
*/

View File

@ -40,9 +40,6 @@ package org.jooq.impl;
import static org.jooq.impl.Tools.map;

View File

@ -37,32 +37,18 @@
*/
package org.jooq.impl;
// ...
// ...
// ...
import static org.jooq.SQLDialect.POSTGRES;
import static org.jooq.impl.DSL.arrayAgg;
import static org.jooq.impl.Keywords.K_ARRAY;
import static org.jooq.impl.Keywords.K_INT;
import static org.jooq.impl.Names.N_ARRAY;
import static org.jooq.impl.QueryPartListView.wrap;
import static org.jooq.impl.Tools.selectQueryImpl;
import static org.jooq.impl.Tools.visitSubquery;
import java.util.Collection;
import java.util.Set;
import org.jooq.Context;
import org.jooq.DataType;
import org.jooq.Field;
import org.jooq.Record1;
import org.jooq.SQLDialect;
import org.jooq.Select;
import org.jooq.Table;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author Lukas Eder
*/

View File

@ -39,9 +39,6 @@ package org.jooq.impl;
import static org.jooq.Clause.CATALOG;
import static org.jooq.Clause.CATALOG_REFERENCE;
import static org.jooq.impl.CatalogImpl.DEFAULT_CATALOG;
import static org.jooq.impl.Tools.findAny;
import static org.jooq.tools.StringUtils.defaultIfNull;
import java.util.Collections;
import java.util.List;

View File

@ -115,7 +115,7 @@ final class CursorImpl<R extends Record> extends AbstractCursor<R> {
}
CursorImpl(ExecuteContext ctx, ExecuteListener listener, Field<?>[] fields, int[] internIndexes, boolean keepStatement, boolean keepResultSet, Class<? extends R> type, int maxRows, boolean autoclosing) {
super(ctx.configuration(), Tools.row0(fields));
super(ctx.configuration(), (AbstractRow<R>) Tools.row0(fields));
this.ctx = ctx;
this.listener = (listener != null ? listener : ExecuteListeners.getAndStart(ctx));
@ -1455,10 +1455,10 @@ final class CursorImpl<R extends Record> extends AbstractCursor<R> {
private class CursorRecordInitialiser implements ThrowingFunction<AbstractRecord, AbstractRecord, SQLException> {
private final AbstractRow initialiserFields;
private int offset;
private final AbstractRow<?> initialiserFields;
private int offset;
CursorRecordInitialiser(AbstractRow initialiserFields, int offset) {
CursorRecordInitialiser(AbstractRow<?> initialiserFields, int offset) {
this.initialiserFields = initialiserFields;
this.offset = offset;
}
@ -1514,7 +1514,7 @@ final class CursorImpl<R extends Record> extends AbstractCursor<R> {
private final <T> void setValue(AbstractRecord record, Field<T> field, int index) throws SQLException {
try {
T value;
AbstractRow nested = null;
AbstractRow<?> nested = null;
Class<? extends AbstractRecord> recordType = null;
if (field instanceof RowField) {
@ -1528,7 +1528,7 @@ final class CursorImpl<R extends Record> extends AbstractCursor<R> {
}
if (nested != null) {
value = (T) Tools.newRecord(true, (Class<AbstractRecord>) recordType, nested, ((DefaultExecuteContext) ctx).originalConfiguration())
value = (T) Tools.newRecord(true, (Class<AbstractRecord>) recordType, (AbstractRow<AbstractRecord>) nested, ((DefaultExecuteContext) ctx).originalConfiguration())
.operate(new CursorRecordInitialiser(nested, offset + index));
offset += nested.size() - 1;

View File

@ -14791,287 +14791,221 @@ public class DSL {
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>1</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row1} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1> Field<Record1<T1>> rowField(Row1<T1> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>2</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row2} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2> Field<Record2<T1, T2>> rowField(Row2<T1, T2> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>3</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row3} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3> Field<Record3<T1, T2, T3>> rowField(Row3<T1, T2, T3> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>4</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row4} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4> Field<Record4<T1, T2, T3, T4>> rowField(Row4<T1, T2, T3, T4> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>5</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row5} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5> Field<Record5<T1, T2, T3, T4, T5>> rowField(Row5<T1, T2, T3, T4, T5> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>6</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row6} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6> Field<Record6<T1, T2, T3, T4, T5, T6>> rowField(Row6<T1, T2, T3, T4, T5, T6> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>7</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row7} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7> Field<Record7<T1, T2, T3, T4, T5, T6, T7>> rowField(Row7<T1, T2, T3, T4, T5, T6, T7> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>8</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row8} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7, T8> Field<Record8<T1, T2, T3, T4, T5, T6, T7, T8>> rowField(Row8<T1, T2, T3, T4, T5, T6, T7, T8> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>9</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row9} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9> Field<Record9<T1, T2, T3, T4, T5, T6, T7, T8, T9>> rowField(Row9<T1, T2, T3, T4, T5, T6, T7, T8, T9> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>10</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row10} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Field<Record10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>> rowField(Row10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>11</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row11} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Field<Record11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>> rowField(Row11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>12</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row12} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Field<Record12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>> rowField(Row12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>13</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row13} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Field<Record13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>> rowField(Row13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>14</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row14} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Field<Record14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>> rowField(Row14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>15</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row15} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Field<Record15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>> rowField(Row15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>16</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row16} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> Field<Record16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>> rowField(Row16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>17</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row17} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> Field<Record17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>> rowField(Row17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>18</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row18} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> Field<Record18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>> rowField(Row18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>19</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row19} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> Field<Record19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>> rowField(Row19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>20</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row20} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> Field<Record20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>> rowField(Row20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>21</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row21} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> Field<Record21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>> rowField(Row21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> row) {
return new RowField<>(row);
}
/**
* EXPERIMENTAL: Turn a row value expression of degree <code>22</code> into a {@code Field}.
* <p>
* Note: Not all databases support row value expressions, but many row value
* expression operations can be emulated on all databases. See relevant row
* value expression method Javadocs for details.
* @deprecated - [#11812] - 3.15.0 - Use {@link Row22} as a {@link SelectField} directly, instead.
*/
@NotNull
@Support
@Deprecated
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> Field<Record22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>> rowField(Row22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> row) {
return new RowField<>(row);
}

View File

@ -3658,7 +3658,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
* @return The converted {@link UDTRecord}
*/
@SuppressWarnings("unchecked")
static final Record pgNewRecord(Class<?> type, AbstractRow fields, final Object object) {
static final Record pgNewRecord(Class<?> type, AbstractRow<Record> fields, final Object object) {
if (object == null)
return null;
@ -3674,7 +3674,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
// - Temporal data
// - Everything else: VARCHAR
if (fields == null && Record.class.isAssignableFrom(type))
fields = Tools.row0(Tools.fields(values.size(), SQLDataType.VARCHAR));
fields = (AbstractRow<Record>) Tools.row0(Tools.fields(values.size(), SQLDataType.VARCHAR));
return Tools.newRecord(true, (Class<Record>) type, fields)
.operate(record -> {

View File

@ -76,7 +76,6 @@ public final class DefaultConverterProvider implements ConverterProvider, Serial
*/
private static final long serialVersionUID = 2937225066265868374L;
@SuppressWarnings("unchecked")
@Nullable
@Override
public final <T, U> Converter<T, U> provide(final Class<T> tType, final Class<U> uType) {

View File

@ -78,7 +78,7 @@ public class EmbeddableRecordImpl<R extends EmbeddableRecord<R>> extends Abstrac
}
public EmbeddableRecordImpl(Row fields) {
super((AbstractRow) fields);
super((AbstractRow<?>) fields);
}
@SuppressWarnings("unchecked")

View File

@ -62,7 +62,7 @@ implements TableField<R, E> {
final Class<E> recordType;
final boolean replacesFields;
final Table<R> table;
final AbstractRow fieldsRow;
final AbstractRow<?> fieldsRow;
/**
* @deprecated - [#11058] - 3.14.5 - This will be removed in the future.
*/

View File

@ -40,11 +40,9 @@ package org.jooq.impl;
// ...
import static org.jooq.conf.ParamType.NAMED;
import static org.jooq.impl.Internal.subscriber;
import static org.jooq.impl.Tools.EMPTY_FIELD;
import static org.jooq.impl.Tools.EMPTY_PARAM;
import static org.jooq.impl.Tools.abstractDMLQuery;
import static org.jooq.impl.Tools.abstractResultQuery;
import static org.jooq.impl.Tools.fieldNameStrings;
import static org.jooq.impl.Tools.fields;
import static org.jooq.impl.Tools.recordFactory;
import static org.jooq.impl.Tools.visitAll;
@ -308,7 +306,7 @@ final class R2DBC {
// TODO: This call is duplicated from CursorImpl and related classes.
// Refactor this call to make sure code is re-used, especially when
// ExecuteListener lifecycle management is implemented
RecordDelegate<AbstractRecord> delegate = Tools.newRecord(true, (Supplier<AbstractRecord>) recordFactory(query.getRecordType(), Tools.row0(fields)), query.configuration());
RecordDelegate<? extends AbstractRecord> delegate = Tools.newRecord(true, (Supplier<? extends AbstractRecord>) recordFactory(query.getRecordType(), Tools.row0(fields)), query.configuration());
return (R) delegate.operate(record -> {

View File

@ -59,7 +59,7 @@ final class RecordImpl1<T1> extends AbstractRecord implements InternalRecord, Re
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl1(AbstractRow row) {
RecordImpl1(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> extends Abstra
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl10(AbstractRow row) {
RecordImpl10(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> extends A
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl11(AbstractRow row) {
RecordImpl11(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> exte
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl12(AbstractRow row) {
RecordImpl12(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl13(AbstractRow row) {
RecordImpl13(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl14(AbstractRow row) {
RecordImpl14(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl15(AbstractRow row) {
RecordImpl15(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl16(AbstractRow row) {
RecordImpl16(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl17(AbstractRow row) {
RecordImpl17(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl18(AbstractRow row) {
RecordImpl18(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl19(AbstractRow row) {
RecordImpl19(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl2<T1, T2> extends AbstractRecord implements InternalRecord
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl2(AbstractRow row) {
RecordImpl2(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl20(AbstractRow row) {
RecordImpl20(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl21(AbstractRow row) {
RecordImpl21(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl22(AbstractRow row) {
RecordImpl22(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl3<T1, T2, T3> extends AbstractRecord implements InternalRe
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl3(AbstractRow row) {
RecordImpl3(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl4<T1, T2, T3, T4> extends AbstractRecord implements Intern
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl4(AbstractRow row) {
RecordImpl4(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl5<T1, T2, T3, T4, T5> extends AbstractRecord implements In
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl5(AbstractRow row) {
RecordImpl5(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl6<T1, T2, T3, T4, T5, T6> extends AbstractRecord implement
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl6(AbstractRow row) {
RecordImpl6(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl7<T1, T2, T3, T4, T5, T6, T7> extends AbstractRecord imple
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl7(AbstractRow row) {
RecordImpl7(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl8<T1, T2, T3, T4, T5, T6, T7, T8> extends AbstractRecord i
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl8(AbstractRow row) {
RecordImpl8(AbstractRow<?> row) {
super(row);
}

View File

@ -59,7 +59,7 @@ final class RecordImpl9<T1, T2, T3, T4, T5, T6, T7, T8, T9> extends AbstractReco
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImpl9(AbstractRow row) {
RecordImpl9(AbstractRow<?> row) {
super(row);
}

View File

@ -58,7 +58,7 @@ final class RecordImplN extends AbstractRecord implements InternalRecord {
*/
private static final long serialVersionUID = -2201346180421463830L;
RecordImplN(AbstractRow row) {
RecordImplN(AbstractRow<?> row) {
super(row);
}

View File

@ -55,8 +55,9 @@ final class ResultAsCursor<R extends Record> extends AbstractCursor<R> {
private final Result<R> result;
private int index;
@SuppressWarnings("unchecked")
ResultAsCursor(Result<R> result) {
super(result.configuration(), (AbstractRow) result.fieldsRow());
super(result.configuration(), (AbstractRow<R>) result.fieldsRow());
this.result = result;
}

View File

@ -59,10 +59,10 @@ final class RowField<ROW extends Row, REC extends Record> extends AbstractField<
/**
* Generated UID
*/
private static final long serialVersionUID = -2065258332642911588L;
private static final long serialVersionUID = -2065258332642911588L;
private final ROW row;
private final AbstractRow emulatedFields;
private final ROW row;
private final AbstractRow<REC> emulatedFields;
RowField(ROW row) {
this(row, N_ROW);
@ -86,10 +86,10 @@ final class RowField<ROW extends Row, REC extends Record> extends AbstractField<
}));
this.row = row;
this.emulatedFields = row0(map(row.fields(), x -> x.as(as + "." + x.getName()), Field[]::new));
this.emulatedFields = (AbstractRow<REC>) row0(map(row.fields(), x -> x.as(as + "." + x.getName()), Field[]::new));
}
AbstractRow emulatedFields() {
AbstractRow<REC> emulatedFields() {
return emulatedFields;
}

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl1<T1> extends AbstractRow implements Row1<T1> {
final class RowImpl1<T1> extends AbstractRow<Record1<T1>> implements Row1<T1> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl1<T1> extends AbstractRow implements Row1<T1> {
}
RowImpl1(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> extends AbstractRow implements Row10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> {
final class RowImpl10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> extends AbstractRow<Record10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>> implements Row10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> extends AbstractR
}
RowImpl10(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> extends AbstractRow implements Row11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> {
final class RowImpl11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> extends AbstractRow<Record11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>> implements Row11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> extends Abst
}
RowImpl11(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> extends AbstractRow implements Row12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> {
final class RowImpl12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> extends AbstractRow<Record12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>> implements Row12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> extends
}
RowImpl12(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> extends AbstractRow implements Row13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> {
final class RowImpl13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> extends AbstractRow<Record13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>> implements Row13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> ex
}
RowImpl13(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> extends AbstractRow implements Row14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> {
final class RowImpl14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> extends AbstractRow<Record14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>> implements Row14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T1
}
RowImpl14(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> extends AbstractRow implements Row15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> {
final class RowImpl15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> extends AbstractRow<Record15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>> implements Row15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T1
}
RowImpl15(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> extends AbstractRow implements Row16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> {
final class RowImpl16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> extends AbstractRow<Record16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>> implements Row16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T1
}
RowImpl16(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> extends AbstractRow implements Row17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> {
final class RowImpl17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> extends AbstractRow<Record17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>> implements Row17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T1
}
RowImpl17(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> extends AbstractRow implements Row18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> {
final class RowImpl18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> extends AbstractRow<Record18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>> implements Row18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T1
}
RowImpl18(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> extends AbstractRow implements Row19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> {
final class RowImpl19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> extends AbstractRow<Record19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>> implements Row19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T1
}
RowImpl19(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl2<T1, T2> extends AbstractRow implements Row2<T1, T2> {
final class RowImpl2<T1, T2> extends AbstractRow<Record2<T1, T2>> implements Row2<T1, T2> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl2<T1, T2> extends AbstractRow implements Row2<T1, T2> {
}
RowImpl2(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> extends AbstractRow implements Row20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> {
final class RowImpl20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> extends AbstractRow<Record20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>> implements Row20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T1
}
RowImpl20(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> extends AbstractRow implements Row21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> {
final class RowImpl21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> extends AbstractRow<Record21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>> implements Row21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T1
}
RowImpl21(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> extends AbstractRow implements Row22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> {
final class RowImpl22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> extends AbstractRow<Record22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>> implements Row22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T1
}
RowImpl22(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl3<T1, T2, T3> extends AbstractRow implements Row3<T1, T2, T3> {
final class RowImpl3<T1, T2, T3> extends AbstractRow<Record3<T1, T2, T3>> implements Row3<T1, T2, T3> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl3<T1, T2, T3> extends AbstractRow implements Row3<T1, T2, T3>
}
RowImpl3(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl4<T1, T2, T3, T4> extends AbstractRow implements Row4<T1, T2, T3, T4> {
final class RowImpl4<T1, T2, T3, T4> extends AbstractRow<Record4<T1, T2, T3, T4>> implements Row4<T1, T2, T3, T4> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl4<T1, T2, T3, T4> extends AbstractRow implements Row4<T1, T2,
}
RowImpl4(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl5<T1, T2, T3, T4, T5> extends AbstractRow implements Row5<T1, T2, T3, T4, T5> {
final class RowImpl5<T1, T2, T3, T4, T5> extends AbstractRow<Record5<T1, T2, T3, T4, T5>> implements Row5<T1, T2, T3, T4, T5> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl5<T1, T2, T3, T4, T5> extends AbstractRow implements Row5<T1,
}
RowImpl5(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl6<T1, T2, T3, T4, T5, T6> extends AbstractRow implements Row6<T1, T2, T3, T4, T5, T6> {
final class RowImpl6<T1, T2, T3, T4, T5, T6> extends AbstractRow<Record6<T1, T2, T3, T4, T5, T6>> implements Row6<T1, T2, T3, T4, T5, T6> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl6<T1, T2, T3, T4, T5, T6> extends AbstractRow implements Row6
}
RowImpl6(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl7<T1, T2, T3, T4, T5, T6, T7> extends AbstractRow implements Row7<T1, T2, T3, T4, T5, T6, T7> {
final class RowImpl7<T1, T2, T3, T4, T5, T6, T7> extends AbstractRow<Record7<T1, T2, T3, T4, T5, T6, T7>> implements Row7<T1, T2, T3, T4, T5, T6, T7> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl7<T1, T2, T3, T4, T5, T6, T7> extends AbstractRow implements
}
RowImpl7(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl8<T1, T2, T3, T4, T5, T6, T7, T8> extends AbstractRow implements Row8<T1, T2, T3, T4, T5, T6, T7, T8> {
final class RowImpl8<T1, T2, T3, T4, T5, T6, T7, T8> extends AbstractRow<Record8<T1, T2, T3, T4, T5, T6, T7, T8>> implements Row8<T1, T2, T3, T4, T5, T6, T7, T8> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl8<T1, T2, T3, T4, T5, T6, T7, T8> extends AbstractRow impleme
}
RowImpl8(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -60,7 +60,7 @@ import org.jooq.Statement;
* @author Lukas Eder
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
final class RowImpl9<T1, T2, T3, T4, T5, T6, T7, T8, T9> extends AbstractRow implements Row9<T1, T2, T3, T4, T5, T6, T7, T8, T9> {
final class RowImpl9<T1, T2, T3, T4, T5, T6, T7, T8, T9> extends AbstractRow<Record9<T1, T2, T3, T4, T5, T6, T7, T8, T9>> implements Row9<T1, T2, T3, T4, T5, T6, T7, T8, T9> {
/**
* Generated UID
@ -72,7 +72,7 @@ final class RowImpl9<T1, T2, T3, T4, T5, T6, T7, T8, T9> extends AbstractRow imp
}
RowImpl9(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -57,7 +57,7 @@ import org.jooq.Statement;
/**
* @author Lukas Eder
*/
final class RowImplN extends AbstractRow implements RowN {
final class RowImplN extends AbstractRow<Record> implements RowN {
/**
* Generated UID
@ -73,7 +73,7 @@ final class RowImplN extends AbstractRow implements RowN {
}
RowImplN(FieldsImpl<?> fields) {
super(fields);
super((FieldsImpl) fields);
}
// ------------------------------------------------------------------------

View File

@ -70,6 +70,7 @@ import org.jooq.Clause;
import org.jooq.Context;
import org.jooq.DataType;
import org.jooq.Field;
import org.jooq.Record2;
import org.jooq.Row2;
import org.jooq.SQLDialect;
@ -82,7 +83,6 @@ final class RowOverlapsCondition<T1, T2> extends AbstractCondition {
* Generated UID
*/
private static final long serialVersionUID = 85887551884667824L;
private static final Clause[] CLAUSES = { CONDITION, CONDITION_OVERLAPS };
private static final Set<SQLDialect> EMULATE_NON_STANDARD_OVERLAPS = SQLDialect.supportedUntil(CUBRID, DERBY, FIREBIRD, H2, MARIADB, MYSQL, SQLITE);
private static final Set<SQLDialect> EMULATE_INTERVAL_OVERLAPS = SQLDialect.supportedBy(HSQLDB);
@ -91,8 +91,8 @@ final class RowOverlapsCondition<T1, T2> extends AbstractCondition {
@SuppressWarnings("unchecked")
RowOverlapsCondition(Row2<T1, T2> left, Row2<T1, T2> right) {
this.left = (Row2<T1, T2>) ((AbstractRow) left).convertTo(right);
this.right = (Row2<T1, T2>) ((AbstractRow) right).convertTo(left);
this.left = (Row2<T1, T2>) ((AbstractRow<?>) left).convertTo(right);
this.right = (Row2<T1, T2>) ((AbstractRow<?>) right).convertTo(left);
}
@Override

View File

@ -3660,6 +3660,8 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
for (SelectFieldOrAsterisk f : list)
if (f instanceof Field<?>)
result.add(getResolveProjection(c, (Field<?>) f));
else if (f instanceof Row)
result.add(getResolveProjection(c, new RowField<Row, Record>((Row) f)));
else if (f instanceof QualifiedAsterisk)
if (((QualifiedAsteriskImpl) f).fields.isEmpty())
if (resolveSupported)

View File

@ -41,11 +41,7 @@ package org.jooq.impl;
import static java.util.Collections.emptyList;
import static org.jooq.SortOrder.DESC;
import static org.jooq.impl.Tools.anyMatch;
import static org.jooq.impl.Tools.map;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.jooq.Field;

View File

@ -903,7 +903,7 @@ final class Tools {
/**
* Create a new record.
*/
static final <R extends Record> RecordDelegate<R> newRecord(boolean fetched, Class<R> type, AbstractRow fields) {
static final <R extends Record> RecordDelegate<R> newRecord(boolean fetched, Class<R> type, AbstractRow<R> fields) {
return newRecord(fetched, type, fields, null);
}
@ -918,13 +918,13 @@ final class Tools {
* Create a new {@link Table} or {@link UDT} record.
*/
static final <R extends Record> RecordDelegate<R> newRecord(boolean fetched, RecordQualifier<R> type, Configuration configuration) {
return newRecord(fetched, type.getRecordType(), (AbstractRow) type.fieldsRow(), configuration);
return newRecord(fetched, type.getRecordType(), (AbstractRow<R>) type.fieldsRow(), configuration);
}
/**
* Create a new record.
*/
static final <R extends Record> RecordDelegate<R> newRecord(boolean fetched, Class<? extends R> type, AbstractRow fields, Configuration configuration) {
static final <R extends Record> RecordDelegate<R> newRecord(boolean fetched, Class<? extends R> type, AbstractRow<? extends R> fields, Configuration configuration) {
return newRecord(fetched, recordFactory(type, fields), configuration);
}
@ -935,44 +935,45 @@ final class Tools {
return new RecordDelegate<>(configuration, factory, fetched);
}
static final AbstractRow row0(FieldsImpl<?> fields) {
@SuppressWarnings({ "unchecked", "rawtypes" })
static final <R extends Record> AbstractRow<R> row0(FieldsImpl<R> fields) {
switch (fields.size()) {
case 1: return new RowImpl1<>(fields);
case 2: return new RowImpl2<>(fields);
case 3: return new RowImpl3<>(fields);
case 4: return new RowImpl4<>(fields);
case 5: return new RowImpl5<>(fields);
case 6: return new RowImpl6<>(fields);
case 7: return new RowImpl7<>(fields);
case 8: return new RowImpl8<>(fields);
case 9: return new RowImpl9<>(fields);
case 10: return new RowImpl10<>(fields);
case 11: return new RowImpl11<>(fields);
case 12: return new RowImpl12<>(fields);
case 13: return new RowImpl13<>(fields);
case 14: return new RowImpl14<>(fields);
case 15: return new RowImpl15<>(fields);
case 16: return new RowImpl16<>(fields);
case 17: return new RowImpl17<>(fields);
case 18: return new RowImpl18<>(fields);
case 19: return new RowImpl19<>(fields);
case 20: return new RowImpl20<>(fields);
case 21: return new RowImpl21<>(fields);
case 22: return new RowImpl22<>(fields);
case 1: return new RowImpl1(fields);
case 2: return new RowImpl2(fields);
case 3: return new RowImpl3(fields);
case 4: return new RowImpl4(fields);
case 5: return new RowImpl5(fields);
case 6: return new RowImpl6(fields);
case 7: return new RowImpl7(fields);
case 8: return new RowImpl8(fields);
case 9: return new RowImpl9(fields);
case 10: return new RowImpl10(fields);
case 11: return new RowImpl11(fields);
case 12: return new RowImpl12(fields);
case 13: return new RowImpl13(fields);
case 14: return new RowImpl14(fields);
case 15: return new RowImpl15(fields);
case 16: return new RowImpl16(fields);
case 17: return new RowImpl17(fields);
case 18: return new RowImpl18(fields);
case 19: return new RowImpl19(fields);
case 20: return new RowImpl20(fields);
case 21: return new RowImpl21(fields);
case 22: return new RowImpl22(fields);
default: return new RowImplN(fields);
default: return (AbstractRow<R>) new RowImplN(fields);
}
}
static final AbstractRow row0(Collection<? extends Field<?>> fields) {
static final AbstractRow<?> row0(Collection<? extends Field<?>> fields) {
return row0(fields.toArray(EMPTY_FIELD));
}
static final AbstractRow row0(Field<?>... fields) {
static final AbstractRow<?> row0(Field<?>... fields) {
return row0(new FieldsImpl<>(fields));
}
@ -1013,7 +1014,7 @@ final class Tools {
* Create a new record factory.
*/
@SuppressWarnings({ "unchecked" })
static final <R extends Record> Supplier<R> recordFactory(Class<? extends R> type, AbstractRow row) {
static final <R extends Record> Supplier<R> recordFactory(Class<? extends R> type, AbstractRow<? extends R> row) {
// An ad-hoc type resulting from a JOIN or arbitrary SELECT
if (type == AbstractRecord.class || type == Record.class || InternalRecord.class.isAssignableFrom(type)) {
@ -5161,6 +5162,7 @@ final class Tools {
static final SelectFieldOrAsterisk qualify(Table<?> table, SelectFieldOrAsterisk field) {
if (field instanceof Field)
return qualify(table, (Field<?>) field);
// [#11812] TODO: handle field instanceof Row
else if (field instanceof Asterisk)
return table.asterisk();
else if (field instanceof QualifiedAsterisk)

View File

@ -101,7 +101,7 @@ public class UpdatableRecordImpl<R extends UpdatableRecord<R>> extends TableReco
@Override
public Record key() {
AbstractRecord result = Tools.newRecord(fetched, AbstractRecord.class, Tools.row0(getPrimaryKey().getFieldsArray())).operate(null);
AbstractRecord result = Tools.newRecord(fetched, AbstractRecord.class, (AbstractRow<AbstractRecord>) Tools.row0(getPrimaryKey().getFieldsArray())).operate(null);
result.setValues(result.fields.fields.fields, this);
return result;
}
@ -430,7 +430,7 @@ public class UpdatableRecordImpl<R extends UpdatableRecord<R>> extends TableReco
// [#3359] The "fetched" flag must be set to false to enforce INSERT statements on
// subsequent store() calls - when Settings.updatablePrimaryKeys is set.
return (R) Tools.newRecord(false, getTable(), configuration())
return Tools.newRecord(false, getTable(), configuration())
.operate(copy -> {
// Copy all fields. This marks them all as isChanged, which is important
@ -441,7 +441,7 @@ public class UpdatableRecordImpl<R extends UpdatableRecord<R>> extends TableReco
if (!key.contains(field))
copy.set((Field) field, get(field));
return (R) copy;
return copy;
});
}