From ce52beb1153cc7100cecf3bd66b3b9fa0991c3bc Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Sun, 5 May 2013 12:47:16 +0200 Subject: [PATCH] [#2441] Add DSL.cast(Field, XXX) for increased API consistency --- jOOQ/src/main/java/org/jooq/impl/DSL.java | 39 +++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index c7a0a51b3b..b570adb385 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -3492,6 +3492,19 @@ public class DSL { return Utils.field(value, as).cast(as); } + /** + * Cast a field to the type of another field. + * + * @param The generic type of the cast field + * @param field The field to cast + * @param as The field whose type is used for the cast + * @return The cast field + */ + @Support + public static Field cast(Field field, Field as) { + return nullSafe(field).cast(as); + } + /** * Cast null to the type of another field. * @@ -3517,6 +3530,19 @@ public class DSL { return Utils.field(value, type).cast(type); } + /** + * Cast a field to another type. + * + * @param The generic type of the cast field + * @param field The field to cast + * @param type The type that is used for the cast + * @return The cast field + */ + @Support + public static Field cast(Field field, Class type) { + return nullSafe(field).cast(type); + } + /** * Cast null to a type. * @@ -3542,6 +3568,19 @@ public class DSL { return Utils.field(value, type).cast(type); } + /** + * Cast a field to another type. + * + * @param The generic type of the cast field + * @param field The value to cast + * @param type The type that is used for the cast + * @return The cast field + */ + @Support + public static Field cast(Field field, DataType type) { + return nullSafe(field).cast(type); + } + /** * Cast null to a type. *