public class

MapperConfigPlugin

extends PluginAdapter
java.lang.Object
   ↳ org.mybatis.generator.api.PluginAdapter
     ↳ org.mybatis.generator.plugins.MapperConfigPlugin

Class Overview

This plugin generates a MapperConfig file containing mapper entries for SQL maps generated for MyBatis3. This demonstrates hooking into the code generation lifecycle and generating additional XML files.

This plugin accepts three properties:

  • fileName (optional) the name of the generated file. this defaults to "SqlMapConfig.xml" if not specified.
  • targetPackage (required) the name of the package where the file should be placed. Specified like "com.mycompany.sql".
  • targetProject (required) the name of the project where the file should be placed.
Note: targetPackage and targetProject follow the same rules as the targetPackage and targetProject values on the sqlMapGenerator configuration element.

Summary

[Expand]
Inherited Fields
From class org.mybatis.generator.api.PluginAdapter
Public Constructors
MapperConfigPlugin()
Public Methods
List<GeneratedXmlFile> contextGenerateAdditionalXmlFiles()
This method can be used to generate any additional XML file needed by your implementation.
boolean sqlMapGenerated(GeneratedXmlFile sqlMap, IntrospectedTable introspectedTable)
This method is called when the SqlMap file has been generated.
boolean validate(List<String> warnings)
[Expand]
Inherited Methods
From class org.mybatis.generator.api.PluginAdapter
From class java.lang.Object
From interface org.mybatis.generator.api.Plugin

Public Constructors

public MapperConfigPlugin ()

Public Methods

public List<GeneratedXmlFile> contextGenerateAdditionalXmlFiles ()

This method can be used to generate any additional XML file needed by your implementation. This method is called once, after all other XML files have been generated.

Returns
  • a List of GeneratedXmlFiles - these files will be saved with the other files from this run.

public boolean sqlMapGenerated (GeneratedXmlFile sqlMap, IntrospectedTable introspectedTable)

This method is called when the SqlMap file has been generated.

Parameters
sqlMap the generated file (containing the file name, package name, and project name)
introspectedTable The class containing information about the table as introspected from the database
Returns
  • true if the sqlMap should be generated, false if the generated sqlMap should be ignored. In the case of multiple plugins, the first plugin returning false will disable the calling of further plugins.

public boolean validate (List<String> warnings)