org.apache.ibatis.abator.internal.rules
Class ConditionalModelRules

java.lang.Object
  extended byorg.apache.ibatis.abator.internal.rules.AbatorRules
      extended byorg.apache.ibatis.abator.internal.rules.ConditionalModelRules

public class ConditionalModelRules
extends AbatorRules

This class encapsulates all the code generation rules for a table using the conditional model. In this model we do not generate primary key or record with BLOBs classes if the class would only hold one field.

Author:
Jeff Butler

Field Summary
 
Fields inherited from class org.apache.ibatis.abator.internal.rules.AbatorRules
columnDefinitions, tableConfiguration
 
Constructor Summary
ConditionalModelRules(TableConfiguration tableConfiguration, ColumnDefinitions columnDefinitions)
           
 
Method Summary
 boolean generateBaseRecordClass()
          Generate a base record if there are any base columns, or if there is only one primary key coulmn (in which case we will not generate a primary key class), or if there is only one BLOB column (in which case we will not generate a record with BLOBs class).
 boolean generatePrimaryKeyClass()
          We generate a primary key if there is more than one primary key field.
 boolean generateRecordWithBLOBsClass()
          We generate a record with BLOBs class if there is more than one BLOB column.
 
Methods inherited from class org.apache.ibatis.abator.internal.rules.AbatorRules
calculateAllFieldsClass, generateBaseResultMap, generateCountByExample, generateDeleteByExample, generateDeleteByPrimaryKey, generateExampleClass, generateInsert, generateResultMapWithBLOBs, generateSelectByExampleWithBLOBs, generateSelectByExampleWithoutBLOBs, generateSelectByPrimaryKey, generateSQLExampleWhereClause, generateUpdateByExampleSelective, generateUpdateByExampleWithBLOBs, generateUpdateByExampleWithoutBLOBs, generateUpdateByPrimaryKeySelective, generateUpdateByPrimaryKeyWithBLOBs, generateUpdateByPrimaryKeyWithoutBLOBs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConditionalModelRules

public ConditionalModelRules(TableConfiguration tableConfiguration,
                             ColumnDefinitions columnDefinitions)
Method Detail

generatePrimaryKeyClass

public boolean generatePrimaryKeyClass()
We generate a primary key if there is more than one primary key field.

Specified by:
generatePrimaryKeyClass in class AbatorRules
Returns:
true if the primary key should be generated

generateBaseRecordClass

public boolean generateBaseRecordClass()
Generate a base record if there are any base columns, or if there is only one primary key coulmn (in which case we will not generate a primary key class), or if there is only one BLOB column (in which case we will not generate a record with BLOBs class).

Specified by:
generateBaseRecordClass in class AbatorRules
Returns:
true if the class should be generated

generateRecordWithBLOBsClass

public boolean generateRecordWithBLOBsClass()
We generate a record with BLOBs class if there is more than one BLOB column. Do not generate a BLOBs class if any other super class would only contain one field

Specified by:
generateRecordWithBLOBsClass in class AbatorRules
Returns:
true if the record with BLOBs class should be generated