org.apache.ibatis.ibator.plugins
Class RenameExampleClassPlugin

java.lang.Object
  extended by org.apache.ibatis.ibator.api.IbatorPluginAdapter
      extended by org.apache.ibatis.ibator.plugins.RenameExampleClassPlugin
All Implemented Interfaces:
IbatorPlugin

public class RenameExampleClassPlugin
extends IbatorPluginAdapter

This plugin demonstrates overriding the initialized() method to rename the generated example classes. Instead of xxxExample, the classes will be named xxxCriteria This plugin accepts two properties:

For example, to change the name of the generated Example classes from xxxExample to xxxCriteria, specify the following:
searchString
Example$
replaceString
Criteria

Author:
Jeff Butler

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.ibatis.ibator.api.IbatorPlugin
IbatorPlugin.ModelClassType
 
Field Summary
 
Fields inherited from class org.apache.ibatis.ibator.api.IbatorPluginAdapter
ibatorContext, properties
 
Constructor Summary
RenameExampleClassPlugin()
           
 
Method Summary
 void initialized(IntrospectedTable introspectedTable)
          This method is called just before the getGeneratedXXXFiles methods are called on the introspected table.
 boolean validate(java.util.List<java.lang.String> warnings)
          This method is called after all the setXXX methods are called, but before any other method is called.
 
Methods inherited from class org.apache.ibatis.ibator.api.IbatorPluginAdapter
contextGenerateAdditionalJavaFiles, contextGenerateAdditionalJavaFiles, contextGenerateAdditionalXmlFiles, contextGenerateAdditionalXmlFiles, daoCountByExampleMethodGenerated, daoCountByExampleMethodGenerated, daoDeleteByExampleMethodGenerated, daoDeleteByExampleMethodGenerated, daoDeleteByPrimaryKeyMethodGenerated, daoDeleteByPrimaryKeyMethodGenerated, daoImplementationGenerated, daoInsertMethodGenerated, daoInsertMethodGenerated, daoInsertSelectiveMethodGenerated, daoInsertSelectiveMethodGenerated, daoInterfaceGenerated, daoSelectByExampleWithBLOBsMethodGenerated, daoSelectByExampleWithBLOBsMethodGenerated, daoSelectByExampleWithoutBLOBsMethodGenerated, daoSelectByExampleWithoutBLOBsMethodGenerated, daoSelectByPrimaryKeyMethodGenerated, daoSelectByPrimaryKeyMethodGenerated, daoUpdateByExampleSelectiveMethodGenerated, daoUpdateByExampleSelectiveMethodGenerated, daoUpdateByExampleWithBLOBsMethodGenerated, daoUpdateByExampleWithBLOBsMethodGenerated, daoUpdateByExampleWithoutBLOBsMethodGenerated, daoUpdateByExampleWithoutBLOBsMethodGenerated, daoUpdateByPrimaryKeySelectiveMethodGenerated, daoUpdateByPrimaryKeySelectiveMethodGenerated, daoUpdateByPrimaryKeyWithBLOBsMethodGenerated, daoUpdateByPrimaryKeyWithBLOBsMethodGenerated, daoUpdateByPrimaryKeyWithoutBLOBsMethodGenerated, daoUpdateByPrimaryKeyWithoutBLOBsMethodGenerated, getIbatorContext, getProperties, modelBaseRecordClassGenerated, modelExampleClassGenerated, modelFieldGenerated, modelGetterMethodGenerated, modelPrimaryKeyClassGenerated, modelRecordWithBLOBsClassGenerated, modelSetterMethodGenerated, setIbatorContext, setProperties, sqlMapCountByExampleElementGenerated, sqlMapDeleteByExampleElementGenerated, sqlMapDeleteByPrimaryKeyElementGenerated, sqlMapDocumentGenerated, sqlMapExampleWhereClauseElementGenerated, sqlMapGenerated, sqlMapInsertElementGenerated, sqlMapInsertSelectiveElementGenerated, sqlMapResultMapWithBLOBsElementGenerated, sqlMapResultMapWithoutBLOBsElementGenerated, 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
 

Constructor Detail

RenameExampleClassPlugin

public RenameExampleClassPlugin()
Method Detail

validate

public boolean validate(java.util.List<java.lang.String> warnings)
Description copied from interface: IbatorPlugin
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 ibator run.
Returns:
true if the plugin is in a valid state. Invalid plugins will not be called

initialized

public void initialized(IntrospectedTable introspectedTable)
Description copied from interface: IbatorPlugin
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.

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.

Warning: 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 modelExampleClassGenerated() method. If you do, the change will not be reflected in other generated artifacts.

Specified by:
initialized in interface IbatorPlugin
Overrides:
initialized in class IbatorPluginAdapter