From 0309bffc111fc9bd8ccbb795743edf42303fe65d Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Thu, 4 Jul 2019 16:25:21 +0200 Subject: [PATCH] [jOOQ/jOOQ#8903] Add Support annotations to DataType methods --- jOOQ/src/main/java/org/jooq/DataType.java | 24 +++++++++++++++++++ .../main/java/org/jooq/impl/SQLDataType.java | 2 ++ 2 files changed, 26 insertions(+) diff --git a/jOOQ/src/main/java/org/jooq/DataType.java b/jOOQ/src/main/java/org/jooq/DataType.java index 47b5a9b231..5fddfcded4 100644 --- a/jOOQ/src/main/java/org/jooq/DataType.java +++ b/jOOQ/src/main/java/org/jooq/DataType.java @@ -37,6 +37,18 @@ */ package org.jooq; +// ... +// ... +import static org.jooq.SQLDialect.HSQLDB; +import static org.jooq.SQLDialect.MARIADB; +// ... +import static org.jooq.SQLDialect.MYSQL; +// ... +import static org.jooq.SQLDialect.POSTGRES; +// ... +import static org.jooq.SQLDialect.SQLITE; +// ... + import java.io.Serializable; import java.sql.Types; import java.util.Collection; @@ -210,6 +222,7 @@ public interface DataType extends Serializable { * @param nullability The new nullability * @return The new data type */ + @Support DataType nullability(Nullability nullability); /** @@ -231,6 +244,7 @@ public interface DataType extends Serializable { * @param nullable The new nullability * @return The new data type */ + @Support DataType nullable(boolean nullable); /** @@ -246,6 +260,7 @@ public interface DataType extends Serializable { /** * Return a new data type like this, with a new collation. */ + @Support({ HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) DataType collation(Collation collation); /** @@ -257,6 +272,7 @@ public interface DataType extends Serializable { /** * Return a new data type like this, with a new character set. */ + @Support({ MARIADB, MYSQL }) DataType characterSet(CharacterSet characterSet); /** @@ -274,6 +290,7 @@ public interface DataType extends Serializable { * @param identity The new identity flag * @return The new data type */ + @Support // TODO: List the correct dialects that support identities DataType identity(boolean identity); /** @@ -293,6 +310,7 @@ public interface DataType extends Serializable { * * @see #defaultValue(Field) */ + @Support DataType defaultValue(T defaultValue); /** @@ -333,6 +351,7 @@ public interface DataType extends Serializable { * * @see #defaultValue(Field) */ + @Support DataType default_(T defaultValue); /** @@ -349,6 +368,7 @@ public interface DataType extends Serializable { * defined by the underlying database. Please refer to your database manual * to learn what expressions are possible. */ + @Support DataType default_(Field defaultValue); /** @@ -390,6 +410,7 @@ public interface DataType extends Serializable { * @param precision The new precision value * @return The new data type */ + @Support DataType precision(int precision); /** @@ -403,6 +424,7 @@ public interface DataType extends Serializable { * @param scale The new scale value * @return The new data type */ + @Support DataType precision(int precision, int scale); /** @@ -427,6 +449,7 @@ public interface DataType extends Serializable { * @param scale The new scale value * @return The new data type */ + @Support DataType scale(int scale); /** @@ -451,6 +474,7 @@ public interface DataType extends Serializable { * @param length The new length value * @return The new data type */ + @Support DataType length(int length); /** diff --git a/jOOQ/src/main/java/org/jooq/impl/SQLDataType.java b/jOOQ/src/main/java/org/jooq/impl/SQLDataType.java index 982825ecf5..c3cfac675a 100644 --- a/jOOQ/src/main/java/org/jooq/impl/SQLDataType.java +++ b/jOOQ/src/main/java/org/jooq/impl/SQLDataType.java @@ -746,6 +746,7 @@ public final class SQLDataType { } private static final void initJSR310Types(SQLDialect family) { + Configuration configuration = new DefaultConfiguration(family); // [#8561] Register JSR-310 types according to their matching JDBC @@ -753,6 +754,7 @@ public final class SQLDataType { new DefaultDataType(family, SQLDataType.LOCALDATE, DATE.getTypeName(configuration), DATE.getCastTypeName(configuration)); new DefaultDataType(family, SQLDataType.LOCALTIME, TIME.getTypeName(configuration), TIME.getCastTypeName(configuration)); new DefaultDataType(family, SQLDataType.LOCALDATETIME, TIMESTAMP.getTypeName(configuration), TIMESTAMP.getCastTypeName(configuration)); + } /**