Package org.mybatis.scripting.thymeleaf
Class SqlGeneratorConfig
java.lang.Object
org.mybatis.scripting.thymeleaf.SqlGeneratorConfig
- Direct Known Subclasses:
ThymeleafLanguageDriverConfig
Configuration class for
SqlGenerator
.- Since:
- 1.0.2
- Author:
- Kazuki Shimizu
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Dialect configuration.static class
Template file configuration. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionClass
<? extends TemplateEngineCustomizer> Deprecated.Get a dialect configuration.Get a template file configuration.boolean
Get whether use the 2-way SQL feature.static SqlGeneratorConfig
Create an instance from default properties file.static SqlGeneratorConfig
newInstanceWithCustomizer
(Consumer<SqlGeneratorConfig> customizer) Create an instance using specified customizer and override using a default properties file.static SqlGeneratorConfig
newInstanceWithProperties
(Properties customProperties) Create an instance from specified properties.static SqlGeneratorConfig
newInstanceWithResourcePath
(String resourcePath) Create an instance from specified properties file.void
setCustomizer
(Class<? extends TemplateEngineCustomizer> customizer) Deprecated.void
setCustomizerInstance
(TemplateEngineCustomizer customizer) void
setUse2way
(boolean use2way) Set whether use the 2-way SQL feature.
-
Constructor Details
-
SqlGeneratorConfig
public SqlGeneratorConfig()
-
-
Method Details
-
isUse2way
public boolean isUse2way()Get whether use the 2-way SQL feature.Default is
true
.- Returns:
- If use the 2-way SQL feature, return
true
-
setUse2way
public void setUse2way(boolean use2way) Set whether use the 2-way SQL feature.- Parameters:
use2way
- If use the 2-way SQL feature, settrue
-
getCustomizer
Deprecated.Get the interface for customizing a default TemplateEngine instanced by the mybatis-thymeleaf.Default is
This method exists for the backward compatibility.null
.
UsegetCustomizerInstance()
instead- Returns:
- the interface for customizing a default TemplateEngine
-
setCustomizer
Deprecated.Set the interface for customizing a default TemplateEngine instanced by the mybatis-thymeleaf.- Parameters:
customizer
- the interface for customizing a default TemplateEngine
-
getCustomizerInstance
-
setCustomizerInstance
-
getTemplateFile
Get a template file configuration.- Returns:
- a template file configuration
-
getDialect
Get a dialect configuration.- Returns:
- a dialect configuration
-
newInstance
Create an instance from default properties file.
If you want to customize a defaultTemplateEngine
, you can configure some property using mybatis-thymeleaf.properties that encoded by UTF-8. Also, you can change the properties file that will read using system property (-Dmybatis-thymeleaf.config.file=... -Dmybatis-thymeleaf.config.encoding=...).
Supported properties are as follows:Supported properties Property Key Description Default General configuration use2way Whether use the 2-way SQL true
customizer The implementation class for customizing a default TemplateEngine
instanced by the MyBatis ThymeleafNone Template file configuration template-file.cache-enabled Whether use the cache feature true
template-file.cache-ttl The cache TTL for resolved templates None(use default value of Thymeleaf) template-file.encoding The character encoding for reading template resources "UTF-8"
template-file.base-dir The base directory for reading template resources None(just under class path) template-file.patterns The patterns for reading as template resources "*.sql"
Dialect configuration dialect.prefix The prefix name of dialect provided by this project "mb"
dialect.like-escape-char The escape character for wildcard of LIKE '\'
(backslash)dialect.like-escape-clause-format The format of escape clause "ESCAPE '%s'"
dialect.like-additional-escape-target-chars The additional escape target characters(custom wildcard characters) for LIKE condition None - Returns:
- a configuration instance
-
newInstanceWithResourcePath
Create an instance from specified properties file.
you can configure some property using specified properties file that encoded by UTF-8. Also, you can change file encoding that will read using system property (-Dmybatis-thymeleaf.config.encoding=...).- Parameters:
resourcePath
- A property file resource path- Returns:
- a configuration instance
- See Also:
-
newInstanceWithProperties
Create an instance from specified properties.- Parameters:
customProperties
- custom configuration properties- Returns:
- a configuration instance
- See Also:
-
newInstanceWithCustomizer
Create an instance using specified customizer and override using a default properties file.- Parameters:
customizer
- baseline customizer- Returns:
- a configuration instance
- See Also:
-