Class StatementBuilder<S extends com.datastax.oss.driver.api.querybuilder.BuildableQuery>

java.lang.Object
org.springframework.data.cassandra.core.cql.util.StatementBuilder<S>
Type Parameters:
S - Statement type

public class StatementBuilder<S extends com.datastax.oss.driver.api.querybuilder.BuildableQuery> extends Object
Functional builder for Cassandra statements. Statements are built by applying builder functions that get applied when building the actual statement. The StatementBuilder provides a mutable container for statement creation allowing a functional declaration of actions that are necessary to build a statement. This class helps building CQL statements as a BuildableQuery classes are typically immutable and require return value tracking across methods that want to apply modifications to a statement.

Building a statement consists of three phases:

  1. Creation of the StatementBuilder with a query stub
  2. Functional declaration applying builder functions, bind functions and on build signals
  3. Building the statement using build()
The initial query stub is used as base object for all built queries. Builder functions are applied each time a statement is built allowing to build multiple statement instances while evolving the actual statement.

The builder can be used for structural evolution and value evolution of statements. Values are bound through binding functions that accept the statement and a TermFactory. Values can be bound inline or through bind markers when building the statement. All functions are applied in the order of their declaration.

All methods returning StatementBuilder point to the same instance. This class is intended for internal use.

Since:
3.0
Author:
Mark Paluch