[jOOQ/jOOQ#11884] Refer to DSL.val() in Javadoc to raise awareness

This commit is contained in:
Lukas Eder 2021-05-12 17:29:22 +02:00
parent abacfcfdc2
commit 4cf6928480
10 changed files with 153 additions and 24 deletions

View File

@ -181,6 +181,8 @@ public interface AlterDomainStep<T> {
/**
* Add the <code>SET DEFAULT</code> clause to the <code>ALTER DOMAIN</code> statement.
*
* @param setDefault is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ FIREBIRD, HSQLDB, POSTGRES })
@NotNull @CheckReturnValue

View File

@ -76,6 +76,8 @@ public interface AlterSequenceFlagsStep<T extends Number> extends AlterSequenceF
/**
* Add the <code>RESTART WITH</code> clause to the <code>ALTER SEQUENCE</code> statement.
*
* @param restartWith is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
@NotNull @CheckReturnValue
@ -90,6 +92,8 @@ public interface AlterSequenceFlagsStep<T extends Number> extends AlterSequenceF
/**
* Add the <code>START WITH</code> clause to the <code>ALTER SEQUENCE</code> statement.
*
* @param startWith is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ MARIADB, POSTGRES })
@NotNull @CheckReturnValue
@ -104,6 +108,8 @@ public interface AlterSequenceFlagsStep<T extends Number> extends AlterSequenceF
/**
* Add the <code>INCREMENT BY</code> clause to the <code>ALTER SEQUENCE</code> statement.
*
* @param incrementBy is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
@NotNull @CheckReturnValue
@ -118,6 +124,8 @@ public interface AlterSequenceFlagsStep<T extends Number> extends AlterSequenceF
/**
* Add the <code>MINVALUE</code> clause to the <code>ALTER SEQUENCE</code> statement.
*
* @param minvalue is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ CUBRID, H2, HSQLDB, MARIADB, POSTGRES })
@NotNull @CheckReturnValue
@ -139,6 +147,8 @@ public interface AlterSequenceFlagsStep<T extends Number> extends AlterSequenceF
/**
* Add the <code>MAXVALUE</code> clause to the <code>ALTER SEQUENCE</code> statement.
*
* @param maxvalue is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ CUBRID, H2, HSQLDB, MARIADB, POSTGRES })
@NotNull @CheckReturnValue
@ -174,6 +184,8 @@ public interface AlterSequenceFlagsStep<T extends Number> extends AlterSequenceF
/**
* Add the <code>CACHE</code> clause to the <code>ALTER SEQUENCE</code> statement.
*
* @param cache is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ CUBRID, H2, MARIADB, POSTGRES })
@NotNull @CheckReturnValue

View File

@ -69,6 +69,8 @@ public interface AlterTypeRenameValueToStep {
/**
* Add the <code>TO</code> clause to the <code>ALTER TYPE</code> statement.
*
* @param renameValueTo is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ POSTGRES })
@NotNull @CheckReturnValue

View File

@ -104,6 +104,8 @@ public interface AlterTypeStep {
/**
* Add the <code>ADD VALUE</code> clause to the <code>ALTER TYPE</code> statement.
*
* @param addValue is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ POSTGRES })
@NotNull @CheckReturnValue
@ -118,6 +120,8 @@ public interface AlterTypeStep {
/**
* Add the <code>RENAME VALUE</code> clause to the <code>ALTER TYPE</code> statement.
*
* @param renameValue is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ POSTGRES })
@NotNull @CheckReturnValue

View File

@ -69,6 +69,8 @@ public interface CreateDomainDefaultStep<T> extends CreateDomainConstraintStep {
/**
* Add the <code>DEFAULT_</code> clause to the <code>CREATE DOMAIN</code> statement.
*
* @param default_ is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ FIREBIRD, H2, HSQLDB, POSTGRES })
@NotNull @CheckReturnValue

View File

@ -69,6 +69,8 @@ public interface CreateSequenceFlagsStep extends CreateSequenceFinalStep {
/**
* Add the <code>START WITH</code> clause to the <code>CREATE SEQUENCE</code> statement.
*
* @param startWith is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
@NotNull @CheckReturnValue
@ -83,6 +85,8 @@ public interface CreateSequenceFlagsStep extends CreateSequenceFinalStep {
/**
* Add the <code>INCREMENT BY</code> clause to the <code>CREATE SEQUENCE</code> statement.
*
* @param incrementBy is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, MARIADB, POSTGRES })
@NotNull @CheckReturnValue
@ -97,6 +101,8 @@ public interface CreateSequenceFlagsStep extends CreateSequenceFinalStep {
/**
* Add the <code>MINVALUE</code> clause to the <code>CREATE SEQUENCE</code> statement.
*
* @param minvalue is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ CUBRID, DERBY, H2, HSQLDB, MARIADB, POSTGRES })
@NotNull @CheckReturnValue
@ -118,6 +124,8 @@ public interface CreateSequenceFlagsStep extends CreateSequenceFinalStep {
/**
* Add the <code>MAXVALUE</code> clause to the <code>CREATE SEQUENCE</code> statement.
*
* @param maxvalue is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ CUBRID, DERBY, H2, HSQLDB, MARIADB, POSTGRES })
@NotNull @CheckReturnValue
@ -153,6 +161,8 @@ public interface CreateSequenceFlagsStep extends CreateSequenceFinalStep {
/**
* Add the <code>CACHE</code> clause to the <code>CREATE SEQUENCE</code> statement.
*
* @param cache is wrapped as {@link org.jooq.impl.DSL#val(T)}.
*/
@Support({ CUBRID, H2, MARIADB, POSTGRES })
@NotNull @CheckReturnValue

View File

@ -83,6 +83,8 @@ package org.jooq;

View File

@ -16102,6 +16102,8 @@ public class DSL {
/**
* The <code>ABS</code> function.
*
* @param number is wrapped as {@link #val(T)}.
*/
@NotNull
@Support
@ -16120,6 +16122,8 @@ public class DSL {
/**
* The <code>ACOS</code> function.
*
* @param number is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16138,6 +16142,8 @@ public class DSL {
/**
* The <code>ASIN</code> function.
*
* @param number is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16156,6 +16162,8 @@ public class DSL {
/**
* The <code>ATAN</code> function.
*
* @param number is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16174,6 +16182,9 @@ public class DSL {
/**
* The <code>ATAN2</code> function.
*
* @param x is wrapped as {@link #val(T)}.
* @param y is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16183,6 +16194,8 @@ public class DSL {
/**
* The <code>ATAN2</code> function.
*
* @param x is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16192,6 +16205,8 @@ public class DSL {
/**
* The <code>ATAN2</code> function.
*
* @param y is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16212,6 +16227,8 @@ public class DSL {
* The <code>CEIL</code> function.
* <p>
* Get the smallest integer value equal or greater to a value.
*
* @param value is wrapped as {@link #val(T)}.
*/
@NotNull
@Support
@ -16232,6 +16249,8 @@ public class DSL {
/**
* The <code>COS</code> function.
*
* @param number is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16250,6 +16269,8 @@ public class DSL {
/**
* The <code>COSH</code> function.
*
* @param number is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16268,6 +16289,8 @@ public class DSL {
/**
* The <code>COT</code> function.
*
* @param number is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16286,6 +16309,8 @@ public class DSL {
/**
* The <code>COTH</code> function.
*
* @param number is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16341,6 +16366,8 @@ public class DSL {
/**
* The <code>EXP</code> function.
*
* @param value is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16361,6 +16388,8 @@ public class DSL {
* The <code>FLOOR</code> function.
* <p>
* Get the biggest integer value equal or less than a value.
*
* @param value is wrapped as {@link #val(T)}.
*/
@NotNull
@Support
@ -16381,6 +16410,8 @@ public class DSL {
/**
* The <code>LN</code> function.
*
* @param value is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16399,6 +16430,9 @@ public class DSL {
/**
* The <code>LOG</code> function.
*
* @param value is wrapped as {@link #val(T)}.
* @param base is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16408,6 +16442,8 @@ public class DSL {
/**
* The <code>LOG</code> function.
*
* @param value is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16417,6 +16453,8 @@ public class DSL {
/**
* The <code>LOG</code> function.
*
* @param base is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16435,6 +16473,8 @@ public class DSL {
/**
* The <code>LOG10</code> function.
*
* @param value is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16464,6 +16504,9 @@ public class DSL {
/**
* The <code>POWER</code> function.
*
* @param value is wrapped as {@link #val(T)}.
* @param exponent is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16473,6 +16516,8 @@ public class DSL {
/**
* The <code>POWER</code> function.
*
* @param value is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16482,6 +16527,8 @@ public class DSL {
/**
* The <code>POWER</code> function.
*
* @param exponent is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16621,6 +16668,8 @@ public class DSL {
* The <code>SIGN</code> function.
* <p>
* Get the sign of a number and return it as any of +1, 0, -1.
*
* @param number is wrapped as {@link #val(T)}.
*/
@NotNull
@Support
@ -16641,6 +16690,8 @@ public class DSL {
/**
* The <code>SIN</code> function.
*
* @param number is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16659,6 +16710,8 @@ public class DSL {
/**
* The <code>SINH</code> function.
*
* @param number is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16677,6 +16730,8 @@ public class DSL {
/**
* The <code>SQRT</code> function.
*
* @param value is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16695,6 +16750,8 @@ public class DSL {
/**
* The <code>SQUARE</code> function.
*
* @param value is wrapped as {@link #val(T)}.
*/
@NotNull
@Support
@ -16713,6 +16770,8 @@ public class DSL {
/**
* The <code>TAN</code> function.
*
* @param number is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16731,6 +16790,8 @@ public class DSL {
/**
* The <code>TANH</code> function.
*
* @param number is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, DERBY, FIREBIRD, H2, HSQLDB, IGNITE, MARIADB, MYSQL, POSTGRES })
@ -16854,6 +16915,8 @@ public class DSL {
* The <code>ASCII</code> function.
* <p>
* The ASCII value of a character.
*
* @param string is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES })
@ -16876,6 +16939,8 @@ public class DSL {
* The <code>BIT_LENGTH</code> function.
* <p>
* The length of a string in bits.
*
* @param string is wrapped as {@link #val(T)}.
*/
@NotNull
@Support
@ -16898,6 +16963,8 @@ public class DSL {
* The <code>CHAR_LENGTH</code> function.
* <p>
* The length of a string in characters.
*
* @param string is wrapped as {@link #val(T)}.
*/
@NotNull
@Support
@ -16918,6 +16985,8 @@ public class DSL {
/**
* The <code>CHR</code> function.
*
* @param number is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE })
@ -16936,6 +17005,8 @@ public class DSL {
/**
* The <code>DIGITS</code> function.
*
* @param value is wrapped as {@link #val(T)}.
*/
@NotNull
@Support
@ -17012,6 +17083,8 @@ public class DSL {
* The <code>LENGTH</code> function, an alias for the <code>CHAR_LENGTH</code> function.
* <p>
* The length of a string in characters.
*
* @param string is wrapped as {@link #val(T)}.
*/
@NotNull
@Support
@ -17034,6 +17107,8 @@ public class DSL {
* The <code>LOWER</code> function.
* <p>
* Turn a string into lower case.
*
* @param string is wrapped as {@link #val(T)}.
*/
@NotNull
@Support
@ -17226,6 +17301,8 @@ public class DSL {
* The <code>MD5</code> function.
* <p>
* Calculate an MD5 hash from a string.
*
* @param string is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ MARIADB, MYSQL, POSTGRES })
@ -17336,6 +17413,8 @@ public class DSL {
* The <code>OCTET_LENGTH</code> function.
* <p>
* The length of a string in octets.
*
* @param string is wrapped as {@link #val(T)}.
*/
@NotNull
@Support
@ -17740,6 +17819,8 @@ public class DSL {
* The <code>REVERSE</code> function.
* <p>
* Reverse a string.
*
* @param string is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ CUBRID, HSQLDB, MARIADB, MYSQL, POSTGRES })
@ -18360,6 +18441,8 @@ public class DSL {
* The <code>TO_HEX</code> function.
* <p>
* Format a number to its hex value.
*
* @param value is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ H2, MARIADB, MYSQL, POSTGRES, SQLITE })
@ -18580,6 +18663,8 @@ public class DSL {
* The <code>UPPER</code> function.
* <p>
* Turn a string into upper case.
*
* @param string is wrapped as {@link #val(T)}.
*/
@NotNull
@Support
@ -19211,6 +19296,8 @@ public class DSL {
/**
* The <code>XMLCOMMENT</code> function.
*
* @param comment is wrapped as {@link #val(T)}.
*/
@NotNull
@Support({ POSTGRES })
@ -19669,6 +19756,10 @@ public class DSL {

View File

@ -48,6 +48,7 @@ import static org.jooq.Clause.MERGE_USING;
import static org.jooq.Clause.MERGE_VALUES;
import static org.jooq.Clause.MERGE_WHEN_MATCHED_THEN_UPDATE;
import static org.jooq.Clause.MERGE_WHEN_NOT_MATCHED_THEN_INSERT;
// ...
import static org.jooq.SQLDialect.FIREBIRD;
import static org.jooq.SQLDialect.H2;
// ...

View File

@ -108,6 +108,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.function.BiFunction;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
@ -2022,10 +2023,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
table = parseTableName();
}
TableLike<?> usingTable = (table != null ? table : using);
if (parseKeywordIf("AS") || !peekKeyword("ON"))
usingTable = usingTable.asTable(parseIdentifier());
TableLike<?> usingTable = parseCorrelationNameIf(table != null ? table : using, () -> peekKeyword("ON"));
parseKeyword("ON");
Condition on = parseCondition();
boolean update = false;
@ -6330,26 +6328,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
}
// TODO UNPIVOT
Name alias = null;
List<Name> columnAliases = null;
if (parseKeywordIf("AS"))
alias = parseIdentifier();
else if (!peekKeyword(KEYWORDS_IN_FROM) && !peekKeyword(KEYWORDS_IN_STATEMENTS))
alias = parseIdentifierIf();
if (alias != null) {
if (parseIf('(')) {
columnAliases = parseIdentifiers();
parse(')');
}
if (columnAliases != null)
result = t(result, true).as(alias, columnAliases.toArray(EMPTY_NAME));
else
result = t(result, true).as(alias);
}
result = parseCorrelationNameIf(result, () -> peekKeyword(KEYWORDS_IN_FROM) || peekKeyword(KEYWORDS_IN_STATEMENTS));
int p = position();
if (parseKeywordIf("WITH")) {
@ -6370,6 +6349,30 @@ final class DefaultParseContext extends AbstractScope implements ParseContext {
return t(result);
}
private final TableLike<?> parseCorrelationNameIf(TableLike<?> result, BooleanSupplier forbiddenKeywords) {
Name alias = null;
List<Name> columnAliases = null;
if (parseKeywordIf("AS"))
alias = parseIdentifier();
else if (!forbiddenKeywords.getAsBoolean())
alias = parseIdentifierIf();
if (alias != null) {
if (parseIf('(')) {
columnAliases = parseIdentifiers();
parse(')');
}
if (columnAliases != null)
result = t(result, true).as(alias, columnAliases.toArray(EMPTY_NAME));
else
result = t(result, true).as(alias);
}
return result;
}