Class ConditionalModelRules
java.lang.Object
org.mybatis.generator.internal.rules.BaseRules
org.mybatis.generator.internal.rules.ConditionalModelRules
- All Implemented Interfaces:
Rules
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.
-
Field Summary
Fields inherited from class org.mybatis.generator.internal.rules.BaseRules
introspectedTable, isModelOnly, tableConfiguration -
Constructor Summary
ConstructorsConstructorDescriptionConditionalModelRules(IntrospectedTable introspectedTable) Instantiates a new conditional model rules. -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanBlobs will be in the base record class if there is only one blob column.booleanGenerate 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).booleanWe generate a primary key if there is more than one primary key field.booleanWe generate a record with BLOBs class if there is more than one BLOB column.Methods inherited from class org.mybatis.generator.internal.rules.BaseRules
calculateAllFieldsClass, generateBaseColumnList, generateBaseResultMap, generateBlobColumnList, generateCountByExample, generateDeleteByExample, generateDeleteByPrimaryKey, generateExampleClass, generateInsert, generateInsertSelective, generateJavaClient, generateMyBatis3UpdateByExampleWhereClause, generateResultMapWithBLOBs, generateSelectByExampleWithBLOBs, generateSelectByExampleWithoutBLOBs, generateSelectByPrimaryKey, generateSQLExampleWhereClause, generateUpdateByExampleSelective, generateUpdateByExampleWithBLOBs, generateUpdateByExampleWithoutBLOBs, generateUpdateByPrimaryKeySelective, generateUpdateByPrimaryKeyWithBLOBs, generateUpdateByPrimaryKeyWithoutBLOBs, getIntrospectedTable
-
Constructor Details
-
ConditionalModelRules
Instantiates a new conditional model rules.- Parameters:
introspectedTable- the introspected table
-
-
Method Details
-
generatePrimaryKeyClass
public boolean generatePrimaryKeyClass()We generate a primary key if there is more than one primary key field.- 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).- Returns:
- true if the class should be generated
-
blobsAreInBaseRecord
private boolean blobsAreInBaseRecord()Blobs will be in the base record class if there is only one blob column.- Returns:
- true if there are blobs but they are in the base record class
-
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- Returns:
- true if the record with BLOBs class should be generated
-