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.

@FunctionalInterface public interface TermFactory
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 Type
    Method
    Description
    default boolean
    Check whether the term factory accepts Collection values to be created as Term.
    com.datastax.oss.driver.api.querybuilder.term.Term
    create(Object value)
    Create a Term for the given value.
    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

      com.datastax.oss.driver.api.querybuilder.term.Term create(@Nullable Object value)
      Create a Term for the given value.
      Parameters:
      value - the value to bind, can be null.
      Returns:
      the Term for the given value.
    • canBindCollection

      default boolean canBindCollection()
      Check whether the term factory accepts Collection values to be created as Term.
      Returns:
      true whether the term factory can Collection values.
      Since:
      3.2.6
    • ifBoundOrInline

      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.
      Type Parameters:
      T -
      Parameters:
      bindingFunction - the binding functions to apply with Bindings 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