Class VelocityLanguageDriverConfig

java.lang.Object
org.mybatis.scripting.velocity.VelocityLanguageDriverConfig

public class VelocityLanguageDriverConfig extends Object
Configuration class for Driver.
Since:
2.1.0
Author:
Kazuki Shimizu
  • Constructor Details

    • VelocityLanguageDriverConfig

      public VelocityLanguageDriverConfig()
  • Method Details

    • getVelocitySettings

      public Map<String,String> getVelocitySettings()
      Get Velocity settings.
      Returns:
      Velocity settings
    • getUserdirective

      @Deprecated public String[] getUserdirective()
      Deprecated.
      Recommend to use the 'velocity-settings.runtime.custom_directives' or 'runtime.custom_directives' because this method defined for keeping backward compatibility (There is possibility that this method removed at a future version)
      Get user define directives.
      Returns:
      user define directives.
    • setUserdirective

      @Deprecated public void setUserdirective(String... userDirectives)
      Deprecated.
      Recommend to use the 'velocity-settings.runtime.custom_directives' or 'runtime.custom_directives' because this method defined for keeping backward compatibility (There is possibility that this method removed at a future version)
      Set user define directives.
      Parameters:
      userDirectives - user define directives
    • getAdditionalContextAttributes

      public Map<String,String> getAdditionalContextAttributes()
      Get additional context attributes.
      Returns:
      additional context attributes
    • generateCustomDirectivesString

      public String generateCustomDirectivesString()
      Generate a custom directives string.
      Returns:
      a custom directives string
    • newInstance

      public static VelocityLanguageDriverConfig newInstance()
      Create an instance from default properties file.
      If you want to customize a default RuntimeInstance, you can configure some property using mybatis-velocity.properties that encoded by UTF-8. Also, you can change the properties file that will read using system property (-Dmybatis-velocity.config.file=... -Dmybatis-velocity.config.encoding=...).
      Supported properties are as follows:
      Supported properties
      Property Key Description Default
      Directive configuration
      userdirective The user defined directives (Recommend to use the 'velocity-settings.runtime.custom_directives' property because this property defined for keeping backward compatibility) None(empty)
      Additional context attribute configuration
      additional.context.attributes The user defined additional context attribute values(Recommend to use the 'additional-context-attributes.{name}' because this property defined for keeping backward compatibility) None(empty)
      additional-context-attributes.{name} The user defined additional context attributes value(FQCN) -
      Velocity settings configuration
      velocity-settings.{name} The settings of Velocity's RuntimeInstance.setProperty(String, Object) -
      {name} The settings of Velocity's RuntimeInstance.setProperty(String, Object) (Recommend to use the 'velocity-settings.{name}' because this property defined for keeping backward compatibility) -
      Returns:
      a configuration instance
    • newInstance

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

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