Package org.mybatis.scripting.thymeleaf
Class SqlGenerator
java.lang.Object
org.mybatis.scripting.thymeleaf.SqlGenerator
The sql template engine for integrating with Thymeleaf.
- Version:
- 1.0.2
- Author:
- Kazuki Shimizu
-
Constructor Summary
ConstructorDescriptionConstructor for creating instance with defaultTemplateEngine
.SqlGenerator
(SqlGeneratorConfig config) Constructor for creating instance with user specifiedSqlGenerator
.SqlGenerator
(org.thymeleaf.ITemplateEngine templateEngine) Constructor for creating instance with user definedITemplateEngine
. -
Method Summary
Modifier and TypeMethodDescriptiongenerate
(CharSequence sqlTemplate, Object parameter) Generate a sql using Thymeleaf template engine.generate
(CharSequence sqlTemplate, Object parameter, BiConsumer<String, Object> customBindVariableBinder) Generate a sql using Thymeleaf template engine.generate
(CharSequence sqlTemplate, Object parameter, BiConsumer<String, Object> customBindVariableBinder, Map<String, Object> customVariables) Generate a sql using Thymeleaf template engine.Generate a sql using Thymeleaf template engine.Get specified default custom variables.void
setDefaultCustomVariables
(Map<String, Object> defaultCustomVariables) Set default custom variables.void
setPropertyAccessor
(PropertyAccessor propertyAccessor) Set a property accessor.
-
Constructor Details
-
SqlGenerator
public SqlGenerator()Constructor for creating instance with defaultTemplateEngine
. -
SqlGenerator
Constructor for creating instance with user specifiedSqlGenerator
.- Parameters:
config
- A user definedSqlGeneratorConfig
instance
-
SqlGenerator
public SqlGenerator(org.thymeleaf.ITemplateEngine templateEngine) Constructor for creating instance with user definedITemplateEngine
.- Parameters:
templateEngine
- A user definedITemplateEngine
instance
-
-
Method Details
-
setDefaultCustomVariables
-
getDefaultCustomVariables
-
setPropertyAccessor
Set a property accessor.Default is
PropertyAccessor.BuiltIn.STANDARD
.- Parameters:
propertyAccessor
- a property accessor
-
generate
Generate a sql using Thymeleaf template engine.- Parameters:
sqlTemplate
- a template SQLparameter
- a parameter object- Returns:
- a processed SQL by template engine
-
generate
public String generate(CharSequence sqlTemplate, Object parameter, BiConsumer<String, Object> customBindVariableBinder) Generate a sql using Thymeleaf template engine.- Parameters:
sqlTemplate
- a template SQLparameter
- a parameter objectcustomBindVariableBinder
- a binder for a custom bind variable that generated withmb:bind
ormb:param
- Returns:
- a processed SQL by template engine
-
generate
public String generate(CharSequence sqlTemplate, Object parameter, Map<String, Object> customVariables) Generate a sql using Thymeleaf template engine.- Parameters:
sqlTemplate
- a template SQLparameter
- a parameter objectcustomVariables
- a custom variables for passing to template engine- Returns:
- a processed SQL by template engine
-
generate
public String generate(CharSequence sqlTemplate, Object parameter, BiConsumer<String, Object> customBindVariableBinder, Map<String, Object> customVariables) Generate a sql using Thymeleaf template engine.- Parameters:
sqlTemplate
- a template SQLparameter
- a parameter objectcustomBindVariableBinder
- a binder for a custom bind variable that generated withmb:bind
ormb:param
customVariables
- a custom variables for passing to template engine- Returns:
- a processed SQL by template engine
-