- All Implemented Interfaces:
Serializable,Binding<T,U>
- Author:
- Lukas Eder
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsConstructorDescriptionDefaultBinding(Binding<T, U> delegate) Deprecated, for removal: This API element is subject to removal in a future version.- 3.21.0 - [#19125] - This class will be removed from public API, do not reuse.DefaultBinding(Converter<T, U> converter) Deprecated, for removal: This API element is subject to removal in a future version.- 3.11 - [#6631] - Usebinding(Converter)instead. -
Method Summary
Modifier and TypeMethodDescriptionGet an array binding for this binding, ornullif no such array binding is available.Binding<?, ?> Get an array component binding for this binding, ornullif this binding isn't for an array type.static final <T,U> Binding <T, U> Get the internal default binding for aConverter.static final <T> Binding<T, T> Get the internal default binding for aDataType.A converter that can convert between the database type and the custom type.Get an optionalFormatterimplementation, instructing jOOQ on how to embed the user type inSQLDataType.JSON,SQLDataType.JSONB, andSQLDataType.XMLcontexts.voidget(BindingGetResultSetContext<U> ctx) Get aResultSet'sOUTvalue.voidget(BindingGetSQLInputContext<U> ctx) Get aSQLInput'sOUTvalue.voidget(BindingGetStatementContext<U> ctx) Get aCallableStatement'sOUTvalue.voidregister(BindingRegisterContext<U> ctx) Register aCallableStatement'sOUTparameter.voidset(BindingSetSQLOutputContext<U> ctx) Set aSQLOutput'sINparameter.voidset(BindingSetStatementContext<U> ctx) Set aPreparedStatement'sINparameter.voidsql(BindingSQLContext<U> ctx) Generate SQL code for the bind variable.toString()
-
Constructor Details
-
DefaultBinding
Deprecated, for removal: This API element is subject to removal in a future version.- 3.11 - [#6631] - Usebinding(Converter)instead. -
DefaultBinding
Deprecated, for removal: This API element is subject to removal in a future version.- 3.21.0 - [#19125] - This class will be removed from public API, do not reuse.
-
-
Method Details
-
binding
Get the internal default binding for aConverter. -
binding
Get the internal default binding for aDataType. -
formatter
Description copied from interface:BindingGet an optionalFormatterimplementation, instructing jOOQ on how to embed the user type inSQLDataType.JSON,SQLDataType.JSONB, andSQLDataType.XMLcontexts.This may be necessary when embedding user-defined types in
DSL.multiset(TableLike)queries, when the user-defined type serialises differently in aNestedCollectionEmulation.JSONBemulation than standalone, for example.A
nullformatter will have no effect on generated SQL.Note: while it is possible to implement a custom formatter for array types, it is usually simpler to just delegate to the
Binding.arrayComponentBinding()for this, and let jOOQ's internals handle the intricate mapping of generic arrays to XML or JSON. -
arrayBinding
Description copied from interface:BindingGet an array binding for this binding, ornullif no such array binding is available.- Specified by:
arrayBindingin interfaceBinding<T,U>
-
arrayComponentBinding
Description copied from interface:BindingGet an array component binding for this binding, ornullif this binding isn't for an array type.Implementations must ensure that the resulting type is
Binding<X, Y>, if this Binding's type variables resolve toT = X[]andU = Y[], as this cannot be enforced by the Java compiler.- Specified by:
arrayComponentBindingin interfaceBinding<T,U>
-
converter
Description copied from interface:BindingA converter that can convert between the database type and the custom type.While the
Converterproperty of a binding is not optional (Converter.fromType()andConverter.toType()are needed by jOOQ's internals), the conversion implementation (i.e.Converter.from(Object)andConverter.to(Object)) isn't strictly required if implementations don't rely on it. If these conversion implementations are non-functional, it is advised to hint at this fact inConverter.fromSupported()andConverter.toSupported(). -
sql
Description copied from interface:BindingGenerate SQL code for the bind variable.Implementations should generate SQL code onto
BindingSQLContext.render(), given the context's bind variable located atBindingSQLContext.value(). Examples of such SQL code are:"?": Default implementations can simply generate a question mark.
"123": Implementations may choose to inline bind variables to influence execution plan generation.
Context.paramType()contains information whether inlined bind variables are expected in the current context.
"CAST(? AS DATE)": Cast a database to a more specific type. This can be useful in databases like Oracle, which map bothDATEandTIMESTAMPSQL types toTimestamp.
Context.castMode()may contain some hints about whether casting is suggested in the current context.
"?::json": Vendor-specific bind variables can be supported, e.g.SQLDialect.POSTGRES's JSON data type.
Implementations must provide consistent behaviour between
Binding.sql(BindingSQLContext)andBinding.set(BindingSetStatementContext), i.e. when bind variables are inlined, then they must not be bound to thePreparedStatementinBinding.set(BindingSetStatementContext)- Specified by:
sqlin interfaceBinding<T,U> - Parameters:
ctx- The context object containing all argument objects.- Throws:
SQLException- Implementations are allowed to pass on allSQLExceptions to the caller to be wrapped inDataAccessExceptions.
-
register
Description copied from interface:BindingRegister aCallableStatement'sOUTparameter.- Specified by:
registerin interfaceBinding<T,U> - Parameters:
ctx- The context object containing all argument objects.- Throws:
SQLException- Implementations are allowed to pass on allSQLExceptions to the caller to be wrapped inDataAccessExceptions.
-
set
Description copied from interface:BindingSet aPreparedStatement'sINparameter.- Specified by:
setin interfaceBinding<T,U> - Parameters:
ctx- The context object containing all argument objects.- Throws:
SQLException- Implementations are allowed to pass on allSQLExceptions to the caller to be wrapped inDataAccessExceptions.
-
set
Description copied from interface:BindingSet aSQLOutput'sINparameter.- Specified by:
setin interfaceBinding<T,U> - Parameters:
ctx- The context object containing all argument objects.- Throws:
SQLException- Implementations are allowed to pass on allSQLExceptions to the caller to be wrapped inDataAccessExceptions.
-
get
Description copied from interface:BindingGet aResultSet'sOUTvalue.Implementations are expected to produce a value by calling
BindingGetResultSetContext.value(Object), passing the resulting value to the method.- Specified by:
getin interfaceBinding<T,U> - Parameters:
ctx- The context object containing all argument objects.- Throws:
SQLException- Implementations are allowed to pass on allSQLExceptions to the caller to be wrapped inDataAccessExceptions.
-
get
Description copied from interface:BindingGet aCallableStatement'sOUTvalue.Implementations are expected to produce a value by calling
BindingGetStatementContext.value(Object), passing the resulting value to the method.- Specified by:
getin interfaceBinding<T,U> - Parameters:
ctx- The context object containing all argument objects.- Throws:
SQLException- Implementations are allowed to pass on allSQLExceptions to the caller to be wrapped inDataAccessExceptions.
-
get
Description copied from interface:BindingGet aSQLInput'sOUTvalue.Implementations are expected to produce a value by calling
BindingGetSQLInputContext.value(Object), passing the resulting value to the method.- Specified by:
getin interfaceBinding<T,U> - Parameters:
ctx- The context object containing all argument objects.- Throws:
SQLException- Implementations are allowed to pass on allSQLExceptions to the caller to be wrapped inDataAccessExceptions.
-
toString
-