diff --git a/jOOQ/src/main/java/org/jooq/DataType.java b/jOOQ/src/main/java/org/jooq/DataType.java index 83c10c9d2b..b0f25c5ef2 100644 --- a/jOOQ/src/main/java/org/jooq/DataType.java +++ b/jOOQ/src/main/java/org/jooq/DataType.java @@ -148,10 +148,24 @@ public interface DataType extends Named { /** * Retrieve the Java type associated with this data type. + *

+ * This is the same as {@link #getUserType()}. */ @NotNull Class getType(); + /** + * The {@link Converter#fromType()} (or database type) in case this {@link DataType} has a converter. + */ + @NotNull + Class getFromType(); + + /** + * The {@link Converter#toType()} (or user type) in case this {@link DataType} has a converter. + */ + @NotNull + Class getToType(); + /** * Get the defining DOMAIN type or NULL if there is no such * type. diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractDataType.java b/jOOQ/src/main/java/org/jooq/impl/AbstractDataType.java index be7181be56..6d6af911e5 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractDataType.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractDataType.java @@ -631,6 +631,16 @@ implements return (@NotNull ContextConverter) ContextConverter.scoped(getBinding().converter()); } + @Override + public final Class getFromType() { + return getConverter().fromType(); + } + + @Override + public final Class getToType() { + return getConverter().toType(); + } + @Override public /* non-final */ String getTypeName() { return getTypeName0(CONFIG_UNQUOTED.get());