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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumstatic enum -
Field Summary
FieldsModifier 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 Contextprotected FullyQualifiedTableprotected final Map<IntrospectedTable.InternalAttribute, String> Internal attributes are used to store commonly accessed items by all code generators.protected final List<IntrospectedColumn> protected StringTable remarks retrieved from database metadata.protected Rulesprotected TableConfigurationprotected StringTable type retrieved from database metadata.protected IntrospectedTable.TargetRuntime -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedIntrospectedTable(IntrospectedTable.TargetRuntime targetRuntime) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddColumn(IntrospectedColumn introspectedColumn) voidaddPrimaryKeyColumn(String columnName) protected Stringabstract voidcalculateGenerators(List<String> warnings, ProgressCallback progressCallback) This method can be used to initialize the generators before they will be called.protected voidprotected Stringprotected StringIf property exampleTargetPackage specified for example use the specified value, else use default value (targetPackage).protected Stringprotected voidprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected voidprivate booleancolumnMatches(IntrospectedColumn introspectedColumn, String columnName) 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 intThis method should return the number of progress messages that will be send during the generation phase.intReturns 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) booleanbooleanbooleanbooleanReturns true if any of the columns in the table are JDBC Dates (as opposed to timestamps).booleanReturns true if any of the columns in the table are JDBC Times (as opposed to timestamps).booleanvoidbooleanbooleanprivate booleanisSubPackagesEnabled(PropertyHolder propertyHolder) voidremoveAttribute(String name) abstract booleanShould return true if an XML generator is required for this table.voidsetAttribute(String name, Object value) voidvoidsetBaseRecordType(String baseRecordType) voidvoidvoidsetContext(Context context) voidvoidvoidvoidsetExampleType(String exampleType) voidvoidsetFullyQualifiedTable(FullyQualifiedTable fullyQualifiedTable) voidvoidvoidsetKotlinRecordType(String kotlinRecordType) voidsetMyBatis3FallbackSqlMapNamespace(String sqlMapNamespace) voidsetMyBatis3JavaMapperType(String mybatis3JavaMapperType) voidsetMyBatis3SqlProviderType(String mybatis3SqlProviderType) voidvoidsetMyBatis3XmlMapperFileName(String mybatis3XmlMapperFileName) voidsetMyBatis3XmlMapperPackage(String mybatis3XmlMapperPackage) voidvoidvoidsetPrimaryKeyType(String primaryKeyType) voidsetRecordWithBLOBsType(String recordWithBLOBsType) voidsetRemarks(String remarks) voidvoidThis method exists to give plugins the opportunity to replace the calculated rules if necessary.voidvoidvoidvoidvoidsetSqlMapAliasedFullyQualifiedRuntimeTableName(String aliasedFullyQualifiedRuntimeTableName) voidsetSqlMapFullyQualifiedRuntimeTableName(String fullyQualifiedRuntimeTableName) voidsetTableConfiguration(TableConfiguration tableConfiguration) voidsetTableType(String tableType) voidvoidvoidvoidvoidvoid
-
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
-
columnMatches
-
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
-
isSubPackagesEnabled
-
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
-