Class SqlGeneratorConfig

java.lang.Object
org.mybatis.scripting.thymeleaf.SqlGeneratorConfig
Direct Known Subclasses:
ThymeleafLanguageDriverConfig

public class SqlGeneratorConfig extends Object
Configuration class for SqlGenerator.
Since:
1.0.2
Author:
Kazuki Shimizu
  • 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, set true
    • getCustomizer

      @Deprecated public Class<? extends TemplateEngineCustomizer> getCustomizer()
      Deprecated.
      Get the interface for customizing a default TemplateEngine instanced by the mybatis-thymeleaf.

      Default is null.

      This method exists for the backward compatibility.
      Use getCustomizerInstance() instead
      Returns:
      the interface for customizing a default TemplateEngine
    • setCustomizer

      @Deprecated public void setCustomizer(Class<? extends TemplateEngineCustomizer> customizer)
      Deprecated.
      Set the interface for customizing a default TemplateEngine instanced by the mybatis-thymeleaf.
      Parameters:
      customizer - the interface for customizing a default TemplateEngine
    • getCustomizerInstance

      public TemplateEngineCustomizer getCustomizerInstance()
    • setCustomizerInstance

      public void setCustomizerInstance(TemplateEngineCustomizer customizer)
    • getTemplateFile

      public SqlGeneratorConfig.TemplateFileConfig getTemplateFile()
      Get a template file configuration.
      Returns:
      a template file configuration
    • getDialect

      public SqlGeneratorConfig.DialectConfig getDialect()
      Get a dialect configuration.
      Returns:
      a dialect configuration
    • newInstance

      public static SqlGeneratorConfig newInstance()
      Create an instance from default properties file.
      If you want to customize a default TemplateEngine, 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 Thymeleaf None
      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

      public static SqlGeneratorConfig newInstanceWithResourcePath(String resourcePath)
      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

      public static SqlGeneratorConfig newInstanceWithProperties(Properties customProperties)
      Create an instance from specified properties.
      Parameters:
      customProperties - custom configuration properties
      Returns:
      a configuration instance
      See Also:
    • newInstanceWithCustomizer

      public static SqlGeneratorConfig newInstanceWithCustomizer(Consumer<SqlGeneratorConfig> customizer)
      Create an instance using specified customizer and override using a default properties file.
      Parameters:
      customizer - baseline customizer
      Returns:
      a configuration instance
      See Also: