org.mybatis.generator.internal.rules
Interface Rules

All Known Implementing Classes:
BaseRules, ConditionalModelRules, FlatModelRules, HierarchicalModelRules, RulesDelegate

public interface Rules

This interface centralizes all the rules related to code generation - including the methods and objects to create, and certain attributes related to those objects.

Author:
Jeff Butler

Method Summary
 FullyQualifiedJavaType calculateAllFieldsClass()
          Calculates the class that contains all fields.
 boolean generateBaseColumnList()
          Implements the rule for generating the SQL base column list element.
 boolean generateBaseRecordClass()
          Implements the rule for generating a base record.
 boolean generateBaseResultMap()
          Implements the rule for generating the result map without BLOBs.
 boolean generateBlobColumnList()
          Implements the rule for generating the SQL blob column list element.
 boolean generateCountByExample()
           
 boolean generateDeleteByExample()
          Implements the rule for generating the delete by example SQL Map element and DAO method.
 boolean generateDeleteByPrimaryKey()
          Implements the rule for generating the delete by primary key SQL Map element and DAO method.
 boolean generateExampleClass()
          Implements the rule for generating an example class.
 boolean generateInsert()
          Implements the rule for generating the insert SQL Map element and DAO method.
 boolean generateInsertSelective()
          Implements the rule for generating the insert selective SQL Map element and DAO method.
 boolean generateJavaClient()
          Implements the rule for generating a Java client.
 boolean generateMyBatis3UpdateByExampleWhereClause()
          Implements the rule for generating the SQL example where clause element specifically for use in the update by example methods.
 boolean generatePrimaryKeyClass()
          Implements the rule for determining whether to generate a primary key class.
 boolean generateRecordWithBLOBsClass()
          Implements the rule for generating a record with BLOBs.
 boolean generateResultMapWithBLOBs()
          Implements the rule for generating the result map with BLOBs.
 boolean generateSelectByExampleWithBLOBs()
          Implements the rule for generating the select by example with BLOBs SQL Map element and DAO method.
 boolean generateSelectByExampleWithoutBLOBs()
          Implements the rule for generating the select by example without BLOBs SQL Map element and DAO method.
 boolean generateSelectByPrimaryKey()
          Implements the rule for generating the select by primary key SQL Map element and DAO method.
 boolean generateSQLExampleWhereClause()
          Implements the rule for generating the SQL example where clause element.
 boolean generateUpdateByExampleSelective()
           
 boolean generateUpdateByExampleWithBLOBs()
           
 boolean generateUpdateByExampleWithoutBLOBs()
           
 boolean generateUpdateByPrimaryKeySelective()
          Implements the rule for generating the update by primary key selective SQL Map element and DAO method.
 boolean generateUpdateByPrimaryKeyWithBLOBs()
          Implements the rule for generating the update by primary key with BLOBs SQL Map element and DAO method.
 boolean generateUpdateByPrimaryKeyWithoutBLOBs()
          Implements the rule for generating the update by primary key without BLOBs SQL Map element and DAO method.
 IntrospectedTable getIntrospectedTable()
           
 

Method Detail

generateInsert

boolean generateInsert()
Implements the rule for generating the insert SQL Map element and DAO method. If the insert statement is allowed, then generate the element and method.

Returns:
true if the element and method should be generated

generateInsertSelective

boolean generateInsertSelective()
Implements the rule for generating the insert selective SQL Map element and DAO method. If the insert statement is allowed, then generate the element and method.

Returns:
true if the element and method should be generated

calculateAllFieldsClass

FullyQualifiedJavaType calculateAllFieldsClass()
Calculates the class that contains all fields. This class is used as the insert statement parameter, as well as the returned value from the select by primary key method. The actual class depends on how the domain model is generated.

Returns:
the type of the class that holds all fields

generateUpdateByPrimaryKeyWithoutBLOBs

boolean generateUpdateByPrimaryKeyWithoutBLOBs()
Implements the rule for generating the update by primary key without BLOBs SQL Map element and DAO method. If the table has a primary key as well as other non-BLOB fields, and the updateByPrimaryKey statement is allowed, then generate the element and method.

Returns:
true if the element and method should be generated

generateUpdateByPrimaryKeyWithBLOBs

boolean generateUpdateByPrimaryKeyWithBLOBs()
Implements the rule for generating the update by primary key with BLOBs SQL Map element and DAO method. If the table has a primary key as well as other BLOB fields, and the updateByPrimaryKey statement is allowed, then generate the element and method.

Returns:
true if the element and method should be generated

generateUpdateByPrimaryKeySelective

boolean generateUpdateByPrimaryKeySelective()
Implements the rule for generating the update by primary key selective SQL Map element and DAO method. If the table has a primary key as well as other fields, and the updateByPrimaryKey statement is allowed, then generate the element and method.

Returns:
true if the element and method should be generated

generateDeleteByPrimaryKey

boolean generateDeleteByPrimaryKey()
Implements the rule for generating the delete by primary key SQL Map element and DAO method. If the table has a primary key, and the deleteByPrimaryKey statement is allowed, then generate the element and method.

Returns:
true if the element and method should be generated

generateDeleteByExample

boolean generateDeleteByExample()
Implements the rule for generating the delete by example SQL Map element and DAO method. If the deleteByExample statement is allowed, then generate the element and method.

Returns:
true if the element and method should be generated

generateBaseResultMap

boolean generateBaseResultMap()
Implements the rule for generating the result map without BLOBs. If either select method is allowed, then generate the result map.

Returns:
true if the result map should be generated

generateResultMapWithBLOBs

boolean generateResultMapWithBLOBs()
Implements the rule for generating the result map with BLOBs. If the table has BLOB columns, and either select method is allowed, then generate the result map.

Returns:
true if the result map should be generated

generateSQLExampleWhereClause

boolean generateSQLExampleWhereClause()
Implements the rule for generating the SQL example where clause element. In iBATIS2, generate the element if the selectByExample, deleteByExample, updateByExample, or countByExample statements are allowed. In MyBatis3, generate the element if the selectByExample, deleteByExample, or countByExample statements are allowed.

Returns:
true if the SQL where clause element should be generated

generateMyBatis3UpdateByExampleWhereClause

boolean generateMyBatis3UpdateByExampleWhereClause()
Implements the rule for generating the SQL example where clause element specifically for use in the update by example methods. In iBATIS2, do not generate the element. In MyBatis, generate the element if the updateByExample statements are allowed.

Returns:
true if the SQL where clause element should be generated

generateBaseColumnList

boolean generateBaseColumnList()
Implements the rule for generating the SQL base column list element. Generate the element if any of the select methods are enabled.

Returns:
true if the SQL base column list element should be generated

generateBlobColumnList

boolean generateBlobColumnList()
Implements the rule for generating the SQL blob column list element. Generate the element if any of the select methods are enabled, and the table contains BLOB columns.

Returns:
true if the SQL blob column list element should be generated

generateSelectByPrimaryKey

boolean generateSelectByPrimaryKey()
Implements the rule for generating the select by primary key SQL Map element and DAO method. If the table has a primary key as well as other fields, and the selectByPrimaryKey statement is allowed, then generate the element and method.

Returns:
true if the element and method should be generated

generateSelectByExampleWithoutBLOBs

boolean generateSelectByExampleWithoutBLOBs()
Implements the rule for generating the select by example without BLOBs SQL Map element and DAO method. If the selectByExample statement is allowed, then generate the element and method.

Returns:
true if the element and method should be generated

generateSelectByExampleWithBLOBs

boolean generateSelectByExampleWithBLOBs()
Implements the rule for generating the select by example with BLOBs SQL Map element and DAO method. If the table has BLOB fields and the selectByExample statement is allowed, then generate the element and method.

Returns:
true if the element and method should be generated

generateExampleClass

boolean generateExampleClass()
Implements the rule for generating an example class. The class should be generated if the selectByExample or deleteByExample or countByExample methods are allowed.

Returns:
true if the example class should be generated

generateCountByExample

boolean generateCountByExample()

generateUpdateByExampleSelective

boolean generateUpdateByExampleSelective()

generateUpdateByExampleWithoutBLOBs

boolean generateUpdateByExampleWithoutBLOBs()

generateUpdateByExampleWithBLOBs

boolean generateUpdateByExampleWithBLOBs()

generatePrimaryKeyClass

boolean generatePrimaryKeyClass()
Implements the rule for determining whether to generate a primary key class. If you return false from this method, and the table has primary key columns, then the primary key columns will be added to the base class.

Returns:
true if a separate primary key class should be generated

generateBaseRecordClass

boolean generateBaseRecordClass()
Implements the rule for generating a base record.

Returns:
true if the class should be generated

generateRecordWithBLOBsClass

boolean generateRecordWithBLOBsClass()
Implements the rule for generating a record with BLOBs. If you return false from this method, and the table had BLOB columns, then the BLOB columns will be added to the base class.

Returns:
true if the record with BLOBs class should be generated

generateJavaClient

boolean generateJavaClient()
Implements the rule for generating a Java client. This rule is only active when a javaClientGenerator configuration has been specified, but the table is designated as "modelOnly". Do not generate the client if the table is designated as modelOnly.

Returns:
true if the Java client should be generated

getIntrospectedTable

IntrospectedTable getIntrospectedTable()


Copyright © 2010-2012 MyBatis.org. All Rights Reserved.