Class FreeMarkerLanguageDriverConfig

java.lang.Object
org.mybatis.scripting.freemarker.FreeMarkerLanguageDriverConfig

public class FreeMarkerLanguageDriverConfig extends Object
Configuration class for FreeMarkerLanguageDriver.
Since:
1.2.0
Author:
Kazuki Shimizu
  • Constructor Details

    • FreeMarkerLanguageDriverConfig

      public FreeMarkerLanguageDriverConfig()
  • Method Details

    • getFreemarkerSettings

      public Map<String,String> getFreemarkerSettings()
      Get FreeMarker settings.
      Returns:
      FreeMarker settings
    • getBasePackage

      @Deprecated public String getBasePackage()
      Deprecated.
      Recommend to use the FreeMarkerLanguageDriverConfig.TemplateFileConfig.getBaseDir()} because this method defined for keeping backward compatibility (There is possibility that this method removed at a future version)
      Get a base directory for reading template resources.

      Default is none (just under classpath).

      Returns:
      a base directory for reading template resources
    • setBasePackage

      @Deprecated public void setBasePackage(String basePackage)
      Deprecated.
      Recommend to use the FreeMarkerLanguageDriverConfig.TemplateFileConfig.setBaseDir(String) because this method defined for keeping backward compatibility (There is possibility that this method removed at a future version)
      Set a base directory for reading template resources.
      Parameters:
      basePackage - a base directory for reading template resources
    • getTemplateFile

      Get a template file configuration.
      Returns:
      a template file configuration
    • newInstance

      public static FreeMarkerLanguageDriverConfig newInstance()
      Create an instance from default properties file.
      If you want to customize a default TemplateEngine, you can configure some property using mybatis-freemarker.properties that encoded by UTF-8. Also, you can change the properties file that will read using system property (-Dmybatis-freemarker.config.file=... -Dmybatis-freemarker.config.encoding=...).
      Supported properties are as follows:
      Supported properties
      Property Key Description Default
      General configuration
      base-package The base directory for reading template resources None(just under classpath)
      freemarker-settings.* The settings of freemarker Configurable.setSetting(String, String)). -
      Returns:
      a configuration instance
    • newInstance

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

      Create an instance using specified customizer and override using a default properties file.
      Parameters:
      customizer - baseline customizer
      Returns:
      a configuration instance
      See Also: