Interface TermFactory
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Factory for
Term
objects encapsulating a binding value
. Classes implementing this factory interface
may return inline terms to render values as part of the query string, or bind markers to supply parameters on
statement creation/parameter binding.
A TermFactory
is typically used with StatementBuilder
.
- Since:
- 3.0
- Author:
- Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
Check whether the term factory acceptsCollection
values to be created asTerm
.com.datastax.oss.driver.api.querybuilder.term.Term
Create aTerm
for the givenvalue
.default <T> T
ifBoundOrInline
(Function<Bindings, T> bindingFunction, Supplier<T> inlineFunction) Apply functions depending on whether the term factory uses bind markers or inline values.
-
Method Details
-
create
Create aTerm
for the givenvalue
.- Parameters:
value
- the value to bind, can be null.- Returns:
- the
Term
for the givenvalue
.
-
canBindCollection
default boolean canBindCollection()Check whether the term factory acceptsCollection
values to be created asTerm
.- Returns:
true
whether the term factory canCollection
values.- Since:
- 3.2.6
-
ifBoundOrInline
Apply functions depending on whether the term factory uses bind markers or inline values.- Type Parameters:
T
-- Parameters:
bindingFunction
- the binding functions to apply withBindings
for bind marker capturing.inlineFunction
- the function to run otherwise, if the term factory uses inline values.- Returns:
- the outcome of the binding operation.
- Since:
- 4.2
-