-
- All Superinterfaces:
Field<T>
,FieldOrConstraint
,FieldOrRow
,GroupField
,Named
,OrderField<T>
,QueryPart
,SelectField<T>
,SelectFieldOrAsterisk
,Serializable
,Typed<T>
public interface Param<T> extends Field<T>
A named parameter and/or bind value.A lot of jOOQ API accepts user input values, such as for example when creating a
Condition
usingField.eq(Object)
, where a column expression is being compared with a value.Behind the scenes, jOOQ wraps the value in a bind value expression using
DSL.val(Object)
. The generated SQL of such an expression depends on things likeSettings.getStatementType()
orParamType
being passed to configurations orQuery.getSQL(ParamType)
calls, etc. By default, a parameter marker?
is generated.Users can create parameters explicitly using
DSL
API, which is useful in a few cases where the value cannot be passed to jOOQ directly, e.g.- When the value is at the left hand side of an operator
- When
Field
references andParam
values are mixed
Example:
// Assuming import static org.jooq.impl.DSL.*; // The bind value is the first operand of an expression, in case of which it // needs to be wrapped in a Param explicitly using(configuration) .select() .from(RENTALS) .where(val(LocalDateTime.now()).between(RENTALS.RENTAL_DATE).and(RENTALS.DUE_DATE)) .fetch(); // The bind value is mixed with other types of Field expressions in a statement using(configuration) .insertInto(ACTOR) .columns(ACTOR.FIRST_NAME, ACTOR.LAST_NAME, ACTOR.LAST_UPDATE) .values(val("John"), val("Doe"), currentTimestamp()) .execute();
Instances can be created using
DSL.param(String, Object)
,DSL.val(Object)
,DSL.inline(Object)
and respective overloads.- Author:
- Lukas Eder
- See Also:
DSL.param(String, Object)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description String
getName()
The name of the field.ParamMode
getParamMode()
The parameter mode.String
getParamName()
The parameter name.ParamType
getParamType()
The parameter type.T
getValue()
Get the parameter's underlying value.boolean
isInline()
A flag on the bind value to force it to be inlined in rendered SQLvoid
setConverted(Object value)
Deprecated.- 3.8.0 - [#4991] In jOOQ 4.0,Param
will be made immutable.void
setInline(boolean inline)
Deprecated.- 3.8.0 - [#4991] In jOOQ 4.0,Param
will be made immutable.void
setValue(T value)
Deprecated.- 3.8.0 - [#4991] In jOOQ 4.0,Param
will be made immutable.-
Methods inherited from interface org.jooq.Field
abs, acos, add, add, as, as, as, as, asc, ascii, asin, atan, atan2, atan2, avg, avgOver, between, between, between, between, betweenSymmetric, betweenSymmetric, betweenSymmetric, betweenSymmetric, bitAnd, bitAnd, bitLength, bitNand, bitNand, bitNor, bitNor, bitNot, bitOr, bitOr, bitXNor, bitXNor, bitXor, bitXor, cast, cast, cast, ceil, changed, charLength, coalesce, coalesce, coerce, coerce, coerce, collate, collate, collate, compare, compare, compare, compare, concat, concat, concat, contains, contains, containsIgnoreCase, containsIgnoreCase, cos, cosh, cot, coth, count, countDistinct, countOver, decode, decode, decode, decode, deg, desc, div, div, divide, divide, endsWith, endsWith, endsWithIgnoreCase, endsWithIgnoreCase, eq, eq, eq, eq, equal, equal, equal, equal, equalIgnoreCase, equalIgnoreCase, equals, exp, extract, field, firstValue, floor, from, ge, ge, ge, ge, get, getComment, getValue, greaterOrEqual, greaterOrEqual, greaterOrEqual, greaterOrEqual, greaterThan, greaterThan, greaterThan, greaterThan, greatest, greatest, gt, gt, gt, gt, in, in, in, in, in, isDistinctFrom, isDistinctFrom, isFalse, isJson, isNotDistinctFrom, isNotDistinctFrom, isNotJson, isNotNull, isNull, isTrue, lag, lag, lag, lag, lastValue, le, le, le, le, lead, lead, lead, lead, least, least, length, lessOrEqual, lessOrEqual, lessOrEqual, lessOrEqual, lessThan, lessThan, lessThan, lessThan, like, like, like, like, like, likeIgnoreCase, likeIgnoreCase, likeIgnoreCase, likeIgnoreCase, likeRegex, likeRegex, ln, log, lower, lpad, lpad, lpad, lpad, lt, lt, lt, lt, ltrim, max, maxOver, median, min, minOver, minus, minus, mod, mod, modulo, modulo, mul, mul, multiply, multiply, ne, ne, ne, ne, neg, notBetween, notBetween, notBetween, notBetween, notBetweenSymmetric, notBetweenSymmetric, notBetweenSymmetric, notBetweenSymmetric, notContains, notContains, notContainsIgnoreCase, notContainsIgnoreCase, notEqual, notEqual, notEqual, notEqual, notEqualIgnoreCase, notEqualIgnoreCase, notIn, notIn, notIn, notIn, notIn, notLike, notLike, notLike, notLike, notLike, notLikeIgnoreCase, notLikeIgnoreCase, notLikeIgnoreCase, notLikeIgnoreCase, notLikeRegex, notLikeRegex, notSimilarTo, notSimilarTo, notSimilarTo, notSimilarTo, nullif, nullif, nvl, nvl, nvl2, nvl2, octetLength, original, plus, plus, plus, position, position, pow, pow, power, power, rad, rem, rem, repeat, repeat, replace, replace, replace, replace, reset, round, round, rpad, rpad, rpad, rpad, rtrim, shl, shl, shr, shr, sign, similarTo, similarTo, similarTo, similarTo, sin, sinh, sort, sort, sortAsc, sortAsc, sortDefault, sortDesc, sortDesc, sqrt, startsWith, startsWith, startsWithIgnoreCase, startsWithIgnoreCase, stddevPop, stddevPopOver, stddevSamp, stddevSampOver, sub, sub, substring, substring, substring, substring, subtract, subtract, sum, sumOver, tan, tanh, times, times, trim, unaryMinus, unaryPlus, upper, varPop, varPopOver, varSamp, varSampOver
-
Methods inherited from interface org.jooq.Named
getQualifiedName, getUnqualifiedName
-
Methods inherited from interface org.jooq.Typed
getBinding, getConverter, getDataType, getDataType, getType
-
-
-
-
Method Detail
-
getName
String getName()
The name of the field.The name is any of these:
- The formal name of the field, if it is a physical table/view field
- The alias of an aliased field
- A generated / unspecified value for any other expression
- The name of a parameter if it is a named
Param
TheParam
's value forgetName()
coincides withgetParamName()
-
getParamName
String getParamName()
The parameter name. This name is useful for two things:- Named parameters in frameworks that support them, such as Spring's
JdbcTemplate
- Accessing the parameter from the
Query
API, withQuery.getParam(String)
,Query.getParams()
- Named parameters in frameworks that support them, such as Spring's
-
getValue
T getValue()
Get the parameter's underlying value. This returnsnull
if no value has been set yet.
-
setValue
@Deprecated void setValue(T value)
Deprecated.Set the parameter's underlying value. This is the same assetConverted(Object)
, but ensures generic type-safety.- See Also:
setConverted(Object)
-
setConverted
@Deprecated void setConverted(Object value) throws DataTypeException
Deprecated.- Throws:
DataTypeException
- Ifvalue
cannot be converted into this parameter's data type.- See Also:
DataType.convert(Object)
,Convert.convert(Object, Class)
-
setInline
@Deprecated void setInline(boolean inline)
Deprecated.A flag on the bind value to force it to be inlined in rendered SQL
-
isInline
boolean isInline()
A flag on the bind value to force it to be inlined in rendered SQL
-
getParamType
ParamType getParamType()
The parameter type.
-
getParamMode
ParamMode getParamMode()
The parameter mode.
-
-