protected abstract static class AbstractQuery.Builder<B extends AbstractQuery.Builder<B,Q>,Q extends AbstractQuery>
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
Builder() |
Modifier and Type | Method and Description |
---|---|
Q |
build()
Creates a new instance of the
StorageQuery with respect to the preconditions. |
protected void |
checkPreconditions()
Checks the preconditions of the query construction.
|
protected abstract Q |
doBuild()
Builds a new instance of the query.
|
protected abstract B |
getThis()
Obtains typed reference to
this . |
B |
setDataSource(DataSourceWrapper dataSource)
Sets the data source to be used for query execution.
|
B |
setTableName(java.lang.String tableName)
Sets the table name to use as a target for the query.
|
public final Q build()
StorageQuery
with respect to the preconditions.checkPreconditions()
protected abstract B getThis()
this
.
This method provides return type covariance in builder setters.
protected void checkPreconditions() throws java.lang.IllegalStateException
Default implementation checks that the data source is not
null
and table name is not an empty string.
Override this method to modify these preconditions.
java.lang.IllegalStateException
- upon a precondition violationprotected abstract Q doBuild()
The construction preconditions are checked before calling this method.
null
instance of the query.public B setDataSource(DataSourceWrapper dataSource)
dataSource
- the data source to usepublic B setTableName(java.lang.String tableName)
tableName
- the table name for the query