org.mybatis.generator.plugins
Class MapperConfigPlugin
java.lang.Object
org.mybatis.generator.api.PluginAdapter
org.mybatis.generator.plugins.MapperConfigPlugin
- All Implemented Interfaces:
- Plugin
public class MapperConfigPlugin
- extends PluginAdapter
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.
- Author:
- Jeff Butler
Methods inherited from class org.mybatis.generator.api.PluginAdapter |
clientCountByExampleMethodGenerated, clientCountByExampleMethodGenerated, clientDeleteByExampleMethodGenerated, clientDeleteByExampleMethodGenerated, clientDeleteByPrimaryKeyMethodGenerated, clientDeleteByPrimaryKeyMethodGenerated, clientGenerated, clientInsertMethodGenerated, clientInsertMethodGenerated, clientInsertSelectiveMethodGenerated, clientInsertSelectiveMethodGenerated, clientSelectAllMethodGenerated, clientSelectAllMethodGenerated, clientSelectByExampleWithBLOBsMethodGenerated, clientSelectByExampleWithBLOBsMethodGenerated, clientSelectByExampleWithoutBLOBsMethodGenerated, clientSelectByExampleWithoutBLOBsMethodGenerated, clientSelectByPrimaryKeyMethodGenerated, clientSelectByPrimaryKeyMethodGenerated, clientUpdateByExampleSelectiveMethodGenerated, clientUpdateByExampleSelectiveMethodGenerated, clientUpdateByExampleWithBLOBsMethodGenerated, clientUpdateByExampleWithBLOBsMethodGenerated, clientUpdateByExampleWithoutBLOBsMethodGenerated, clientUpdateByExampleWithoutBLOBsMethodGenerated, clientUpdateByPrimaryKeySelectiveMethodGenerated, clientUpdateByPrimaryKeySelectiveMethodGenerated, clientUpdateByPrimaryKeyWithBLOBsMethodGenerated, clientUpdateByPrimaryKeyWithBLOBsMethodGenerated, clientUpdateByPrimaryKeyWithoutBLOBsMethodGenerated, clientUpdateByPrimaryKeyWithoutBLOBsMethodGenerated, contextGenerateAdditionalJavaFiles, contextGenerateAdditionalJavaFiles, contextGenerateAdditionalXmlFiles, getContext, getProperties, initialized, modelBaseRecordClassGenerated, modelExampleClassGenerated, modelFieldGenerated, modelGetterMethodGenerated, modelPrimaryKeyClassGenerated, modelRecordWithBLOBsClassGenerated, modelSetterMethodGenerated, providerApplyWhereMethodGenerated, providerCountByExampleMethodGenerated, providerDeleteByExampleMethodGenerated, providerGenerated, providerInsertSelectiveMethodGenerated, providerSelectByExampleWithBLOBsMethodGenerated, providerSelectByExampleWithoutBLOBsMethodGenerated, providerUpdateByExampleSelectiveMethodGenerated, providerUpdateByExampleWithBLOBsMethodGenerated, providerUpdateByExampleWithoutBLOBsMethodGenerated, providerUpdateByPrimaryKeySelectiveMethodGenerated, setContext, setProperties, sqlMapBaseColumnListElementGenerated, sqlMapBlobColumnListElementGenerated, sqlMapCountByExampleElementGenerated, sqlMapDeleteByExampleElementGenerated, sqlMapDeleteByPrimaryKeyElementGenerated, sqlMapDocumentGenerated, sqlMapExampleWhereClauseElementGenerated, sqlMapInsertElementGenerated, sqlMapInsertSelectiveElementGenerated, sqlMapResultMapWithBLOBsElementGenerated, sqlMapResultMapWithoutBLOBsElementGenerated, sqlMapSelectAllElementGenerated, sqlMapSelectByExampleWithBLOBsElementGenerated, sqlMapSelectByExampleWithoutBLOBsElementGenerated, sqlMapSelectByPrimaryKeyElementGenerated, sqlMapUpdateByExampleSelectiveElementGenerated, sqlMapUpdateByExampleWithBLOBsElementGenerated, sqlMapUpdateByExampleWithoutBLOBsElementGenerated, sqlMapUpdateByPrimaryKeySelectiveElementGenerated, sqlMapUpdateByPrimaryKeyWithBLOBsElementGenerated, sqlMapUpdateByPrimaryKeyWithoutBLOBsElementGenerated |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MapperConfigPlugin
public MapperConfigPlugin()
validate
public boolean validate(List<String> warnings)
- Description copied from interface:
Plugin
- This method is called after all the setXXX methods are called, but before
any other method is called. This allows the plugin to determine whether
it can run or not. For example, if the plugin requires certain properties
to be set, and the properties are not set, then the plugin is invalid and
will not run.
- Parameters:
warnings
- add strings to this list to specify warnings. For example, if
the plugin is invalid, you should specify why. Warnings are
reported to users after the completion of the run.
- Returns:
- true if the plugin is in a valid state. Invalid plugins will not
be called
contextGenerateAdditionalXmlFiles
public List<GeneratedXmlFile> contextGenerateAdditionalXmlFiles()
- Description copied from interface:
Plugin
- 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.
- Specified by:
contextGenerateAdditionalXmlFiles
in interface Plugin
- Overrides:
contextGenerateAdditionalXmlFiles
in class PluginAdapter
- Returns:
- a List of GeneratedXmlFiles - these files will be saved
with the other files from this run.
sqlMapGenerated
public boolean sqlMapGenerated(GeneratedXmlFile sqlMap,
IntrospectedTable introspectedTable)
- Description copied from interface:
Plugin
- This method is called when the SqlMap file has been generated.
- Specified by:
sqlMapGenerated
in interface Plugin
- Overrides:
sqlMapGenerated
in class PluginAdapter
- 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.
Copyright © 2010-2012 MyBatis.org. All Rights Reserved.