Package org.mybatis.generator.api
Class IntrospectedTable
java.lang.Object
org.mybatis.generator.api.IntrospectedTable
- Direct Known Subclasses:
IntrospectedTableMyBatis3Impl
Base class for all code generator implementations. This class provides many
of the housekeeping methods needed to implement a code generator, with only
the actual code generation methods left unimplemented.
- Author:
- Jeff Butler
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static enum
static enum
-
Field Summary
Modifier and TypeFieldDescriptionAttributes may be used by plugins to capture table related state between the different plugin calls.protected final List
<IntrospectedColumn> protected final List
<IntrospectedColumn> protected Context
protected FullyQualifiedTable
protected final Map
<IntrospectedTable.InternalAttribute, String> Internal attributes are used to store commonly accessed items by all code generators.protected final List
<IntrospectedColumn> protected String
Table remarks retrieved from database metadata.protected Rules
protected TableConfiguration
protected String
Table type retrieved from database metadata.protected IntrospectedTable.TargetRuntime
-
Constructor Summary
ModifierConstructorDescriptionprotected
IntrospectedTable
(IntrospectedTable.TargetRuntime targetRuntime) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addColumn
(IntrospectedColumn introspectedColumn) void
addPrimaryKeyColumn
(String columnName) protected String
abstract void
calculateGenerators
(List<String> warnings, ProgressCallback progressCallback) This method can be used to initialize the generators before they will be called.protected void
protected String
protected String
If property exampleTargetPackage specified for example use the specified value, else use default value (targetPackage).protected String
protected void
protected String
protected String
protected String
protected String
protected String
protected void
Returns all columns in the table (for use by the select by primary key and select by example with BLOBs methods).getAttribute
(String name) Gets the base record type.Gets the example type.abstract List
<GeneratedJavaFile> This method should return a list of generated Java files related to this table.abstract List
<GeneratedKotlinFile> This method should return a list of generated Kotlin files related to this table.abstract List
<GeneratedXmlFile> This method should return a list of generated XML files related to this table.abstract int
This method should return the number of progress messages that will be send during the generation phase.int
Returns all columns except BLOBs (for use by the select by example without BLOBs method).Returns the columns in the primary key.Gets the record with blo bs type.getRules()
getTableConfigurationProperty
(String property) boolean
boolean
boolean
boolean
Returns true if any of the columns in the table are JDBC Dates (as opposed to timestamps).boolean
Returns true if any of the columns in the table are JDBC Times (as opposed to timestamps).boolean
void
boolean
boolean
void
removeAttribute
(String name) abstract boolean
Should return true if an XML generator is required for this table.void
setAttribute
(String name, Object value) void
void
setBaseRecordType
(String baseRecordType) void
void
void
setContext
(Context context) void
void
void
void
setExampleType
(String exampleType) void
void
setFullyQualifiedTable
(FullyQualifiedTable fullyQualifiedTable) void
void
void
setKotlinRecordType
(String kotlinRecordType) void
setMyBatis3FallbackSqlMapNamespace
(String sqlMapNamespace) void
setMyBatis3JavaMapperType
(String mybatis3JavaMapperType) void
setMyBatis3SqlProviderType
(String mybatis3SqlProviderType) void
void
setMyBatis3XmlMapperFileName
(String mybatis3XmlMapperFileName) void
setMyBatis3XmlMapperPackage
(String mybatis3XmlMapperPackage) void
void
void
setPrimaryKeyType
(String primaryKeyType) void
setRecordWithBLOBsType
(String recordWithBLOBsType) void
setRemarks
(String remarks) void
void
This method exists to give plugins the opportunity to replace the calculated rules if necessary.void
void
void
void
void
setSqlMapAliasedFullyQualifiedRuntimeTableName
(String aliasedFullyQualifiedRuntimeTableName) void
setSqlMapFullyQualifiedRuntimeTableName
(String fullyQualifiedRuntimeTableName) void
setTableConfiguration
(TableConfiguration tableConfiguration) void
setTableType
(String tableType) void
void
void
void
void
void
-
Field Details
-
tableConfiguration
-
fullyQualifiedTable
-
context
-
rules
-
-
baseColumns
-
blobColumns
-
targetRuntime
-
attributes
Attributes may be used by plugins to capture table related state between the different plugin calls. -
internalAttributes
Internal attributes are used to store commonly accessed items by all code generators. -
remarks
Table remarks retrieved from database metadata. -
tableType
Table type retrieved from database metadata.
-
-
Constructor Details
-
IntrospectedTable
-
-
Method Details
-
getFullyQualifiedTable
-
getSelectByExampleQueryId
-
getSelectByPrimaryKeyQueryId
-
getGeneratedKey
-
getColumn
-
hasJDBCDateColumns
public boolean hasJDBCDateColumns()Returns true if any of the columns in the table are JDBC Dates (as opposed to timestamps).- Returns:
- true if the table contains DATE columns
-
hasJDBCTimeColumns
public boolean hasJDBCTimeColumns()Returns true if any of the columns in the table are JDBC Times (as opposed to timestamps).- Returns:
- true if the table contains TIME columns
-
getPrimaryKeyColumns
Returns the columns in the primary key. If the generatePrimaryKeyClass() method returns false, then these columns will be iterated as the parameters of the selectByPrimaryKay and deleteByPrimaryKey methods- Returns:
- a List of ColumnDefinition objects for columns in the primary key
-
hasPrimaryKeyColumns
public boolean hasPrimaryKeyColumns() -
getBaseColumns
-
getAllColumns
Returns all columns in the table (for use by the select by primary key and select by example with BLOBs methods).- Returns:
- a List of ColumnDefinition objects for all columns in the table
-
getNonBLOBColumns
Returns all columns except BLOBs (for use by the select by example without BLOBs method).- Returns:
- a List of ColumnDefinition objects for columns in the table that are non BLOBs
-
getNonBLOBColumnCount
public int getNonBLOBColumnCount() -
getNonPrimaryKeyColumns
-
getBLOBColumns
-
hasBLOBColumns
public boolean hasBLOBColumns() -
hasBaseColumns
public boolean hasBaseColumns() -
getRules
-
getTableConfigurationProperty
-
getPrimaryKeyType
-
getBaseRecordType
Gets the base record type.- Returns:
- the type for the record (the class that holds non-primary key and non-BLOB fields). Note that the value will be calculated regardless of whether the table has these columns or not.
-
getKotlinRecordType
-
getExampleType
Gets the example type.- Returns:
- the type for the example class.
-
getRecordWithBLOBsType
Gets the record with blo bs type.- Returns:
- the type for the record with BLOBs class. Note that the value will be calculated regardless of whether the table has BLOB columns or not.
-
getMyBatis3SqlMapNamespace
-
getMyBatis3FallbackSqlMapNamespace
-
hasAnyColumns
public boolean hasAnyColumns() -
setTableConfiguration
-
setFullyQualifiedTable
-
setContext
-
addColumn
-
addPrimaryKeyColumn
-
getAttribute
-
removeAttribute
-
setAttribute
-
initialize
public void initialize() -
calculateXmlAttributes
protected void calculateXmlAttributes() -
setBlobColumnListId
-
setBaseColumnListId
-
setExampleWhereClauseId
-
setMyBatis3UpdateByExampleWhereClauseId
-
setResultMapWithBLOBsId
-
setBaseResultMapId
-
setUpdateByPrimaryKeyWithBLOBsStatementId
-
setUpdateByPrimaryKeySelectiveStatementId
-
setUpdateByPrimaryKeyStatementId
-
setUpdateByExampleWithBLOBsStatementId
-
setUpdateByExampleSelectiveStatementId
-
setUpdateByExampleStatementId
-
setSelectByPrimaryKeyStatementId
-
setSelectByExampleWithBLOBsStatementId
-
setSelectAllStatementId
-
setSelectByExampleStatementId
-
setInsertSelectiveStatementId
-
setInsertStatementId
-
setDeleteByPrimaryKeyStatementId
-
setDeleteByExampleStatementId
-
setCountByExampleStatementId
-
getBlobColumnListId
-
getBaseColumnListId
-
getExampleWhereClauseId
-
getMyBatis3UpdateByExampleWhereClauseId
-
getResultMapWithBLOBsId
-
getBaseResultMapId
-
getUpdateByPrimaryKeyWithBLOBsStatementId
-
getUpdateByPrimaryKeySelectiveStatementId
-
getUpdateByPrimaryKeyStatementId
-
getUpdateByExampleWithBLOBsStatementId
-
getUpdateByExampleSelectiveStatementId
-
getUpdateByExampleStatementId
-
getSelectByPrimaryKeyStatementId
-
getSelectByExampleWithBLOBsStatementId
-
getSelectAllStatementId
-
getSelectByExampleStatementId
-
getInsertSelectiveStatementId
-
getInsertStatementId
-
getDeleteByPrimaryKeyStatementId
-
getDeleteByExampleStatementId
-
getCountByExampleStatementId
-
getMyBatisDynamicSQLTableObjectName
-
setMyBatisDynamicSQLTableObjectName
-
calculateJavaClientInterfacePackage
-
calculateDynamicSqlSupportPackage
-
calculateJavaClientAttributes
protected void calculateJavaClientAttributes() -
calculateJavaModelPackage
-
calculateModelAttributes
protected void calculateModelAttributes() -
calculateJavaModelExamplePackage
If property exampleTargetPackage specified for example use the specified value, else use default value (targetPackage).- Returns:
- the calculated package
-
calculateSqlMapPackage
-
calculateMyBatis3XmlMapperFileName
-
calculateMyBatis3FallbackSqlMapNamespace
-
calculateSqlMapFullyQualifiedRuntimeTableName
-
calculateSqlMapAliasedFullyQualifiedRuntimeTableName
-
getFullyQualifiedTableNameAtRuntime
-
getAliasedFullyQualifiedTableNameAtRuntime
-
calculateGenerators
This method can be used to initialize the generators before they will be called.This method is called after all the setX methods, but before getNumberOfSubtasks(), getGeneratedJavaFiles, and getGeneratedXmlFiles.
- Parameters:
warnings
- the warningsprogressCallback
- the progress callback
-
getGeneratedJavaFiles
This method should return a list of generated Java files related to this table. This list could include various types of model classes, as well as DAO classes.- Returns:
- the list of generated Java files for this table
-
getGeneratedXmlFiles
This method should return a list of generated XML files related to this table. Most implementations will only return one file - the generated SqlMap file.- Returns:
- the list of generated XML files for this table
-
getGeneratedKotlinFiles
This method should return a list of generated Kotlin files related to this table. This list could include a data classes, a mapper interface, extension methods, etc.- Returns:
- the list of generated Kotlin files for this table
-
getGenerationSteps
public abstract int getGenerationSteps()This method should return the number of progress messages that will be send during the generation phase.- Returns:
- the number of progress messages
-
setRules
This method exists to give plugins the opportunity to replace the calculated rules if necessary.- Parameters:
rules
- the new rules
-
getTableConfiguration
-
setPrimaryKeyType
-
setBaseRecordType
-
setKotlinRecordType
-
setRecordWithBLOBsType
-
setExampleType
-
setMyBatis3FallbackSqlMapNamespace
-
setSqlMapFullyQualifiedRuntimeTableName
-
setSqlMapAliasedFullyQualifiedRuntimeTableName
public void setSqlMapAliasedFullyQualifiedRuntimeTableName(String aliasedFullyQualifiedRuntimeTableName) -
getMyBatis3XmlMapperPackage
-
setMyBatis3XmlMapperPackage
-
getMyBatis3XmlMapperFileName
-
setMyBatis3XmlMapperFileName
-
getMyBatis3JavaMapperType
-
setMyBatis3JavaMapperType
-
getMyBatis3SqlProviderType
-
setMyBatis3SqlProviderType
-
getMyBatisDynamicSqlSupportType
-
setMyBatisDynamicSqlSupportType
-
getTargetRuntime
-
isImmutable
public boolean isImmutable() -
isConstructorBased
public boolean isConstructorBased() -
requiresXMLGenerator
public abstract boolean requiresXMLGenerator()Should return true if an XML generator is required for this table. This method will be called during validation of the configuration, so it should not rely on database introspection. This method simply tells the validator if an XML configuration is normally required for this implementation.- Returns:
- true, if successful
-
getContext
-
getRemarks
-
setRemarks
-
getTableType
-
setTableType
-