diff --git a/jOOQ/src/main/java/org/jooq/Field.java b/jOOQ/src/main/java/org/jooq/Field.java index 0fac147675..07dc014ea4 100644 --- a/jOOQ/src/main/java/org/jooq/Field.java +++ b/jOOQ/src/main/java/org/jooq/Field.java @@ -78,6 +78,8 @@ import java.util.Map; import java.util.function.Function; import org.jooq.conf.Settings; +import org.jooq.exception.MappingException; +import org.jooq.impl.CustomField; import org.jooq.impl.DSL; import org.jooq.types.Interval; // ... @@ -149,6 +151,58 @@ extends // API // ------------------------------------------------------------------------ + /** + * Apply an ad-hoc data type {@link Binding} to this field expression. + *
+ * Rather than attaching data type bindings at code generation time, or
+ * creating cumbersome expressions using
+ * {@link DataType#asConvertedDataType(Binding)}, this method allows for
+ * creating a derived field expression with an ad-hoc data type binding for
+ * single query usage.
+ *
+ * @param The user type.
+ * @param binding The binding to be applied on any operations using this
+ * field.
+ * @return A derived field expression using a new binding.
+ */
+ Field convert(Binding
+ * Rather than attaching data type converters at code generation time, or
+ * creating cumbersome expressions using
+ * {@link DataType#asConvertedDataType(Converter)}, this method allows for
+ * creating a derived field expression with an ad-hoc data type converter for
+ * single query usage.
+ *
+ * @param The user type.
+ * @param converter The converter to be applied on any operations using this
+ * field.
+ * @return A derived field expression using a new converter.
+ */
+ Field convert(Converter
+ * Rather than attaching data type converters at code generation time, or
+ * creating cumbersome expressions using
+ * {@link DataType#asConvertedDataType(Class, Function, Function)}, this
+ * method allows for creating a derived field expression with an ad-hoc data
+ * type converter for single query usage.
+ *
+ * @param The user type.
+ * @param converter The converter to be applied on any operations using this
+ * field.
+ * @return A derived field expression using a new converter.
+ */
+ Field convert(
+ Class toType,
+ Function super T, ? extends U> from,
+ Function super U, ? extends T> to
+ );
+
/**
* The name of the field.
*
diff --git a/jOOQ/src/main/java/org/jooq/RecordMapper.java b/jOOQ/src/main/java/org/jooq/RecordMapper.java
index 9f8c2c2be6..144d8678b0 100644
--- a/jOOQ/src/main/java/org/jooq/RecordMapper.java
+++ b/jOOQ/src/main/java/org/jooq/RecordMapper.java
@@ -37,6 +37,8 @@
*/
package org.jooq;
+import java.util.function.Function;
+
import org.jetbrains.annotations.Nullable;
/**
@@ -61,7 +63,7 @@ import org.jetbrains.annotations.Nullable;
* @author Lukas Eder
*/
@FunctionalInterface
-public interface RecordMapper