java.lang.Object
st.orm.template.impl.SqlTemplateImpl
- All Implemented Interfaces:
SqlTemplate
SqlTemplateImpl relies on preview features of the Java platform:
SqlTemplateImplrefers to one or more preview APIs:StringTemplate.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
The sql template implementation that is responsible for generating SQL queries.
-
Nested Class Summary
Nested classes/interfaces inherited from interface st.orm.template.SqlTemplate
SqlTemplate.BatchListener, SqlTemplate.BindVariables, SqlTemplate.NamedParameter, SqlTemplate.Parameter, SqlTemplate.PositionalParameter, SqlTemplate.RecordListener -
Field Summary
Fields inherited from interface st.orm.template.SqlTemplate
JPA, PS -
Constructor Summary
ConstructorsConstructorDescriptionSqlTemplateImpl(boolean positionalOnly, boolean expandCollection, boolean supportRecords) SqlTemplateImpl(boolean positionalOnly, boolean expandCollection, boolean supportRecords, ModelBuilder modelBuilder, TableAliasResolver tableAliasResolver, SqlDialect dialect) -
Method Summary
Modifier and TypeMethodDescriptionReturns the column name resolver that is used by this template.Create a new bind variables instance that can be used to add bind variables to a batch.dialect()Returns the SQL dialect that is used by this template.booleanReturnstrueif collection parameters must be expanded as multiple (positional) parameters,falseotherwise.Returns the foreign key resolver that is used by this template.booleanReturnstrueif the template only support positional parameters,falseotherwise.process(StringTemplatePREVIEW template) Processes the specifiedtemplateand returns the resulting SQL and parameters.booleanReturnstrueif the template supports tables represented as records,falseotherwise.Returns the table alias resolver that is used by this template.Returns the table name resolver that is used by this template.withColumnNameResolver(ColumnNameResolver columnNameResolver) Returns a new SQL template with the specified column name resolver.withDialect(SqlDialect dialect) Returns a new SQL template with the specified SQL dialect.withForeignKeyResolver(ForeignKeyResolver foreignKeyResolver) Returns a new SQL template with the specified foreign key resolver.withSupportRecords(boolean supportRecords) Returns a new SQL template with support for records enabled or disabled.withTableAliasResolver(TableAliasResolver tableAliasResolver) Returns a new SQL template with the specified table alias resolver.withTableNameResolver(TableNameResolver tableNameResolver) Returns a new SQL template with the specified table name resolver.
-
Constructor Details
-
SqlTemplateImpl
public SqlTemplateImpl(boolean positionalOnly, boolean expandCollection, boolean supportRecords) -
SqlTemplateImpl
public SqlTemplateImpl(boolean positionalOnly, boolean expandCollection, boolean supportRecords, @Nonnull ModelBuilder modelBuilder, @Nonnull TableAliasResolver tableAliasResolver, @Nonnull SqlDialect dialect)
-
-
Method Details
-
positionalOnly
public boolean positionalOnly()Returnstrueif the template only support positional parameters,falseotherwise.- Specified by:
positionalOnlyin interfaceSqlTemplate- Returns:
trueif the template only support positional parameters,falseotherwise.
-
expandCollection
public boolean expandCollection()Returnstrueif collection parameters must be expanded as multiple (positional) parameters,falseotherwise.- Specified by:
expandCollectionin interfaceSqlTemplate- Returns:
trueif the template expands collection parameters,falseotherwise.
-
withTableNameResolver
Returns a new SQL template with the specified table name resolver.- Specified by:
withTableNameResolverin interfaceSqlTemplate- Parameters:
tableNameResolver- the table name resolver.- Returns:
- a new SQL template.
-
tableNameResolver
Returns the table name resolver that is used by this template.- Specified by:
tableNameResolverin interfaceSqlTemplate- Returns:
- the table name resolver that is used by this template.
-
withTableAliasResolver
Returns a new SQL template with the specified table alias resolver.- Specified by:
withTableAliasResolverin interfaceSqlTemplate- Parameters:
tableAliasResolver- the table alias resolver.- Returns:
- a new SQL template.
-
tableAliasResolver
Returns the table alias resolver that is used by this template.- Specified by:
tableAliasResolverin interfaceSqlTemplate- Returns:
- the table alias resolver that is used by this template.
-
withColumnNameResolver
Returns a new SQL template with the specified column name resolver.- Specified by:
withColumnNameResolverin interfaceSqlTemplate- Parameters:
columnNameResolver- the column name resolver.- Returns:
- a new SQL template.
-
columnNameResolver
Returns the column name resolver that is used by this template.- Specified by:
columnNameResolverin interfaceSqlTemplate- Returns:
- the column name resolver that is used by this template.
-
withForeignKeyResolver
Returns a new SQL template with the specified foreign key resolver.- Specified by:
withForeignKeyResolverin interfaceSqlTemplate- Parameters:
foreignKeyResolver- the foreign key resolver.- Returns:
- a new SQL template.
-
foreignKeyResolver
Returns the foreign key resolver that is used by this template.- Specified by:
foreignKeyResolverin interfaceSqlTemplate- Returns:
- the foreign key resolver that is used by this template.
-
withDialect
Returns a new SQL template with the specified SQL dialect.- Specified by:
withDialectin interfaceSqlTemplate- Parameters:
dialect- the SQL dialect to use.- Returns:
- a new SQL template.
-
dialect
Returns the SQL dialect that is used by this template.- Specified by:
dialectin interfaceSqlTemplate- Returns:
- the SQL dialect that is used by this template.
- Since:
- 1.2
-
withSupportRecords
Returns a new SQL template with support for records enabled or disabled.- Specified by:
withSupportRecordsin interfaceSqlTemplate- Parameters:
supportRecords-trueif the template should support records,falseotherwise.- Returns:
- a new SQL template.
-
supportRecords
public boolean supportRecords()Returnstrueif the template supports tables represented as records,falseotherwise.- Specified by:
supportRecordsin interfaceSqlTemplate- Returns:
trueif the template supports records,falseotherwise.
-
createBindVars
Create a new bind variables instance that can be used to add bind variables to a batch.- Specified by:
createBindVarsin interfaceSqlTemplate- Returns:
- a new bind variables instance.
-
process
Processes the specifiedtemplateand returns the resulting SQL and parameters.- Specified by:
processin interfaceSqlTemplate- Parameters:
template- the string template to process.- Returns:
- the resulting SQL and parameters.
- Throws:
SqlTemplateException- if an error occurs while processing the input.
-
SqlTemplateImplwhen preview features are enabled.