/**
* Copyright 2006-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mybatis.generator.api;
import java.util.List;
import java.util.Properties;
import org.mybatis.generator.api.dom.java.Field;
import org.mybatis.generator.api.dom.java.Interface;
import org.mybatis.generator.api.dom.java.Method;
import org.mybatis.generator.api.dom.java.TopLevelClass;
import org.mybatis.generator.api.dom.xml.Document;
import org.mybatis.generator.api.dom.xml.XmlElement;
import org.mybatis.generator.config.Context;
/**
* 这个接口定义了在不同时间被调用的方法
* 代码生成过程。 这些方法可以用来扩展或修改
* 生成的代码。 客户可以完整地实现这个接口,或者
* 扩展PluginAdapter(强烈推荐)。
* <p>
* 插件有一个生命周期。 一般来说,生命周期是这样的:
*
* <ol>
* <li>setXXX方法被调用一次</li>
* <li>validate方法调用,该方法一般用于验证传给参数的正确性,如果该方法返回false,则该插件结束执行;</li>
* <li>initialized方法被调用,用于初始化操作,传入IntrospectedTable</li>
* <li>为每个introspected table调用clientXXX方法</li>
* <li>为每个introspected table调用providerXXX方法</li>
* <li>为每个introspected table调用modelXXX方法</li>
* <li>为每个introspected table调用sqlMapXXX方法</li>
* <li>contextGenerateAdditionalJavaFiles(IntrospectedTable)方法调用(生成额外的Java文件,MBG自己是没有实现这个方法的,提供给插件一个扩展机会)</li>
* <li>contextGenerateAdditionalXmlFiles(IntrospectedTable)方法调用(同理,生成额外的XML文件,MBG自己是没有实现这个方法的,提供给插件一个扩展机会)</li>
* <li>contextGenerateAdditionalJavaFiles()方法调用,同contextGenerateAdditionalJavaFiles(IntrospectedTable)方法,只是没有参数而已</li>
* <li>contextGenerateAdditionalXmlFiles()方法调用,同contextGenerateAdditionalXmlFiles(IntrospectedTable)方法,只是没有提供参数</li>
* </ol>
*
*插件与上下文相关 - 所以每个上下文将有自己的一套
*插件。 如果在多个上下文中指定了相同的插件,则每个插件
*上下文将保存插件的唯一实例。
* <p>
*以指定的顺序调用插件,并初始化配置文件。
* <p>
*clientXXX,modelXXX和sqlMapXXX方法由generators调用
*如果你用其他的替换默认的代码生成器实现
*这些方法可能不会被调用。
*
* @author Jeff Butler
* @see PluginAdapter
*
*/
public interface Plugin {
/**
* The Enum ModelClassType.
*/
public enum ModelClassType {
/** The primary key. */
PRIMARY_KEY,
/** The base record. */
BASE_RECORD,
/** The record with blobs. */
RECORD_WITH_BLOBS
}
/**
* 设置这个插件运行的环境。
*
* @param context
* the new context
*/
void setContext(Context context);
/**
* 从插件配置中设置属性。
*
* @param properties
* the new properties
*/
void setProperties(Properties properties);
/**
* This method is called just before the getGeneratedXXXFiles methods are called on the introspected table. Plugins
* can implement this method to override any of the default attributes, or change the results of database
* introspection, before any code generation activities occur. Attributes are listed as static Strings with the
* prefix ATTR_ in IntrospectedTable.
* <p>
* A good example of overriding an attribute would be the case where a user wanted to change the name of one of the
* generated classes, change the target package, or change the name of the generated SQL map file.
* <p>
* <b>Warning:</b> Anything that is listed as an attribute should not be changed by one of the other plugin methods.
* For example, if you want to change the name of a generated example class, you should not simply change the Type
* in the <code>modelExampleClassGenerated()</code> method. If you do, the change will not be reflected in other
* generated artifacts.
*
* @param introspectedTable
* the introspected table
*/
void initialized(IntrospectedTable introspectedTable);
/**
* 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.
*
* @param 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.
* @return true if the plugin is in a valid state. Invalid plugins will not
* be called
*/
boolean validate(List<String> warnings);
/**
* This method can be used to generate any additional Java file needed by
* your implementation. This method is called once, after all other Java
* files have been generated.
*
* @return a List of GeneratedJavaFiles - these files will be saved
* with the other files from this run.
*/
List<GeneratedJavaFile> contextGenerateAdditionalJavaFiles();
/**
* This method can be used to generate additional Java files needed by your
* implementation that might be related to a specific table. This method is
* called once for every table in the configuration.
*
* @param introspectedTable
* The class containing information about the table as
* introspected from the database
* @return a List of GeneratedJavaFiles - these files will be saved
* with the other files from this run.
*/
List<GeneratedJavaFile> contextGenerateAdditionalJavaFiles(
IntrospectedTable introspectedTable);
/**
* 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.
*
* @return a List of GeneratedXmlFiles - these files will be saved
* with the other files from this run.
*/
List<GeneratedXmlFile> contextGenerateAdditionalXmlFiles();
/**
* This method can be used to generate additional XML files needed by your
* implementation that might be related to a specific table. This method is
* called once for every table in the configuration.
*
* @param introspectedTable
* The class containing information about the table as
* introspected from the database
* @return a List of GeneratedXmlFiles - these files will be saved
* with the other files from this run.
*/
List<GeneratedXmlFile> contextGenerateAdditionalXmlFiles(
IntrospectedTable introspectedTable);
/**
* This method is called when the entire client
没有合适的资源?快使用搜索试试~ 我知道了~
MyBatis Generator自定义插件实现自定义Mapper
共579个文件
class:280个
java:269个
xml:9个
4星 · 超过85%的资源 需积分: 32 151 下载量 10 浏览量
2017-12-02
20:03:29
上传
评论 3
收藏 5.59MB 7Z 举报
温馨提示
MyBatis Generator自定义插件实现自定义Mapper,方便代码复用。
资源推荐
资源详情
资源评论
收起资源包目录
MyBatis Generator自定义插件实现自定义Mapper (579个子文件)
IntrospectedTable.class 27KB
ExampleGenerator.class 27KB
PluginAggregator.class 26KB
SqlReservedWords.class 24KB
ExampleGenerator.class 23KB
DatabaseIntrospector.class 22KB
MyBatisGeneratorConfigurationParser.class 20KB
Context.class 17KB
BaseExample$GeneratedCriteria.class 15KB
TableConfiguration.class 14KB
DAOGenerator.class 13KB
PluginAdapter.class 12KB
Healthyorder.class 12KB
DefaultCommentGenerator.class 11KB
PaginationPlugin.class 11KB
MyBatisGenerator.class 10KB
XMLMapperGenerator.class 10KB
ObjectFactory.class 10KB
IntrospectedTableMyBatis3Impl.class 10KB
FullyQualifiedJavaType.class 10KB
JavaMapperGenerator.class 10KB
SqlMapGenerator.class 10KB
BaseRecordGenerator.class 10KB
AbstractDAOTemplate.class 9KB
EqualsHashCodePlugin.class 9KB
IntrospectedTableIbatis2Java2Impl.class 9KB
SimpleModelGenerator.class 8KB
ProviderApplyWhereMethodGenerator.class 8KB
RecordWithBLOBsGenerator.class 8KB
InnerClass.class 8KB
BaseExample$Criteria.class 8KB
SqlProviderGenerator.class 8KB
JavaBeansUtil.class 7KB
Method.class 7KB
AnnotatedClientGenerator.class 7KB
PrimaryKeyGenerator.class 7KB
XmlFileMergerJaxp.class 7KB
IntrospectedColumn.class 7KB
DomWriter.class 7KB
BaseRecordGenerator.class 7KB
MapperPlugin.class 7KB
ShellRunner.class 7KB
InnerEnum.class 7KB
BaseRules.class 7KB
InsertMethodGenerator.class 7KB
InsertSelectiveMethodGenerator.class 7KB
SelectByPrimaryKeyMethodGenerator.class 7KB
SimpleJavaClientGenerator.class 7KB
Interface.class 7KB
ProviderUpdateByExampleSelectiveMethodGenerator.class 7KB
DeleteByPrimaryKeyMethodGenerator.class 6KB
JavaTypeResolverDefaultImpl.class 6KB
SelectByExampleWithoutBLOBsMethodGenerator.class 6KB
ProviderUpdateByExampleWithoutBLOBsMethodGenerator.class 6KB
ExampleWhereClauseElementGenerator.class 6KB
ProviderSelectByExampleWithoutBLOBsMethodGenerator.class 6KB
SelectByExampleWithBLOBsMethodGenerator.class 6KB
ProviderUpdateByPrimaryKeySelectiveMethodGenerator.class 6KB
RecordWithBLOBsGenerator.class 6KB
UpdateByExampleSelectiveMethodGenerator.class 6KB
RowBoundsPlugin.class 6KB
ConfigurationParser.class 6KB
UpdateByExampleWithBLOBsMethodGenerator.class 6KB
UpdateByExampleWithoutBLOBsMethodGenerator.class 6KB
PrimaryKeyGenerator.class 6KB
ProviderInsertSelectiveMethodGenerator.class 6KB
GeneratorAntTask.class 6KB
FullyQualifiedTable.class 6KB
AnnotatedSelectByPrimaryKeyMethodGenerator.class 6KB
UpdateByPrimaryKeySelectiveMethodGenerator.class 6KB
UpdateByPrimaryKeyWithBLOBsMethodGenerator.class 6KB
SimpleXMLMapperGenerator.class 6KB
IbatorConfigurationParser.class 5KB
InsertElementGenerator.class 5KB
CountByExampleMethodGenerator.class 5KB
InsertSelectiveElementGenerator.class 5KB
ExampleWhereClauseElementGenerator.class 5KB
UpdateByPrimaryKeyWithoutBLOBsMethodGenerator.class 5KB
DeleteByExampleMethodGenerator.class 5KB
ResultMapWithoutBLOBsElementGenerator.class 5KB
Plugin.class 5KB
ResultMapWithBLOBsElementGenerator.class 5KB
SelectByPrimaryKeyMethodGenerator.class 5KB
InsertElementGenerator.class 5KB
DeleteByPrimaryKeyMethodGenerator.class 5KB
SqlMapConfigPlugin.class 5KB
MapperConfigPlugin.class 5KB
ExtendedDAOMethodNameCalculator.class 5KB
InsertSelectiveElementGenerator.class 5KB
TopLevelClass.class 5KB
SelectByPrimaryKeyElementGenerator.class 5KB
AnnotatedSelectAllMethodGenerator.class 5KB
TopLevelEnumeration.class 5KB
Page.class 4KB
RootClassInfo.class 4KB
SimpleSelectByPrimaryKeyElementGenerator.class 4KB
ToStringPlugin.class 4KB
ProviderCountByExampleMethodGenerator.class 4KB
IntrospectedTable$InternalAttribute.class 4KB
UpdateByPrimaryKeyWithBLOBsElementGenerator.class 4KB
共 579 条
- 1
- 2
- 3
- 4
- 5
- 6
码农致富
- 粉丝: 3670
- 资源: 112
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- stm32 usb接口通信
- Chessmate是一款完全免费的国际象棋学习软件,支持引擎分析,学开局、残局、棋书解读、大数据分析等功能
- 总结整理的Android面试Java基础知识点面试资料精编汇总文档资料合集.zip
- .android_lq
- FDN5632N-VB一款SOT23封装N-Channel场效应MOS管
- 毛老板-2404250902.amr
- Java类加载流程(双亲委派)流程图.zip
- FDN5632-NL-VB一款SOT23封装N-Channel场效应MOS管
- 新目标大学英语(第二版)视听说教程 第1册 Unit 4 TOP课件.zip
- 自动驾驶-状态估计和定位之Error State EKF.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页