Class IntrospectedTable

java.lang.Object
org.mybatis.generator.api.IntrospectedTable
Direct Known Subclasses:
IntrospectedTableMyBatis3Impl

public abstract class IntrospectedTable extends Object
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
  • Field Details

  • Constructor Details

  • Method Details

    • getFullyQualifiedTable

      public FullyQualifiedTable getFullyQualifiedTable()
    • getSelectByExampleQueryId

      public String getSelectByExampleQueryId()
    • getSelectByPrimaryKeyQueryId

      public String getSelectByPrimaryKeyQueryId()
    • getGeneratedKey

      public Optional<GeneratedKey> getGeneratedKey()
    • getColumn

      public Optional<IntrospectedColumn> getColumn(String columnName)
    • 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

      public List<IntrospectedColumn> 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

      public List<IntrospectedColumn> getBaseColumns()
    • getAllColumns

      public List<IntrospectedColumn> 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

      public List<IntrospectedColumn> 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

      public List<IntrospectedColumn> getNonPrimaryKeyColumns()
    • getBLOBColumns

      public List<IntrospectedColumn> getBLOBColumns()
    • hasBLOBColumns

      public boolean hasBLOBColumns()
    • hasBaseColumns

      public boolean hasBaseColumns()
    • getRules

      public Rules getRules()
    • getTableConfigurationProperty

      public String getTableConfigurationProperty(String property)
    • getPrimaryKeyType

      public String getPrimaryKeyType()
    • getBaseRecordType

      public String 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

      public String getKotlinRecordType()
    • getExampleType

      public String getExampleType()
      Gets the example type.
      Returns:
      the type for the example class.
    • getRecordWithBLOBsType

      public String 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

      public String getMyBatis3SqlMapNamespace()
    • getMyBatis3FallbackSqlMapNamespace

      public String getMyBatis3FallbackSqlMapNamespace()
    • hasAnyColumns

      public boolean hasAnyColumns()
    • setTableConfiguration

      public void setTableConfiguration(TableConfiguration tableConfiguration)
    • setFullyQualifiedTable

      public void setFullyQualifiedTable(FullyQualifiedTable fullyQualifiedTable)
    • setContext

      public void setContext(Context context)
    • addColumn

      public void addColumn(IntrospectedColumn introspectedColumn)
    • addPrimaryKeyColumn

      public void addPrimaryKeyColumn(String columnName)
    • getAttribute

      public Object getAttribute(String name)
    • removeAttribute

      public void removeAttribute(String name)
    • setAttribute

      public void setAttribute(String name, Object value)
    • initialize

      public void initialize()
    • calculateXmlAttributes

      protected void calculateXmlAttributes()
    • setBlobColumnListId

      public void setBlobColumnListId(String s)
    • setBaseColumnListId

      public void setBaseColumnListId(String s)
    • setExampleWhereClauseId

      public void setExampleWhereClauseId(String s)
    • setMyBatis3UpdateByExampleWhereClauseId

      public void setMyBatis3UpdateByExampleWhereClauseId(String s)
    • setResultMapWithBLOBsId

      public void setResultMapWithBLOBsId(String s)
    • setBaseResultMapId

      public void setBaseResultMapId(String s)
    • setUpdateByPrimaryKeyWithBLOBsStatementId

      public void setUpdateByPrimaryKeyWithBLOBsStatementId(String s)
    • setUpdateByPrimaryKeySelectiveStatementId

      public void setUpdateByPrimaryKeySelectiveStatementId(String s)
    • setUpdateByPrimaryKeyStatementId

      public void setUpdateByPrimaryKeyStatementId(String s)
    • setUpdateByExampleWithBLOBsStatementId

      public void setUpdateByExampleWithBLOBsStatementId(String s)
    • setUpdateByExampleSelectiveStatementId

      public void setUpdateByExampleSelectiveStatementId(String s)
    • setUpdateByExampleStatementId

      public void setUpdateByExampleStatementId(String s)
    • setSelectByPrimaryKeyStatementId

      public void setSelectByPrimaryKeyStatementId(String s)
    • setSelectByExampleWithBLOBsStatementId

      public void setSelectByExampleWithBLOBsStatementId(String s)
    • setSelectAllStatementId

      public void setSelectAllStatementId(String s)
    • setSelectByExampleStatementId

      public void setSelectByExampleStatementId(String s)
    • setInsertSelectiveStatementId

      public void setInsertSelectiveStatementId(String s)
    • setInsertStatementId

      public void setInsertStatementId(String s)
    • setDeleteByPrimaryKeyStatementId

      public void setDeleteByPrimaryKeyStatementId(String s)
    • setDeleteByExampleStatementId

      public void setDeleteByExampleStatementId(String s)
    • setCountByExampleStatementId

      public void setCountByExampleStatementId(String s)
    • getBlobColumnListId

      public String getBlobColumnListId()
    • getBaseColumnListId

      public String getBaseColumnListId()
    • getExampleWhereClauseId

      public String getExampleWhereClauseId()
    • getMyBatis3UpdateByExampleWhereClauseId

      public String getMyBatis3UpdateByExampleWhereClauseId()
    • getResultMapWithBLOBsId

      public String getResultMapWithBLOBsId()
    • getBaseResultMapId

      public String getBaseResultMapId()
    • getUpdateByPrimaryKeyWithBLOBsStatementId

      public String getUpdateByPrimaryKeyWithBLOBsStatementId()
    • getUpdateByPrimaryKeySelectiveStatementId

      public String getUpdateByPrimaryKeySelectiveStatementId()
    • getUpdateByPrimaryKeyStatementId

      public String getUpdateByPrimaryKeyStatementId()
    • getUpdateByExampleWithBLOBsStatementId

      public String getUpdateByExampleWithBLOBsStatementId()
    • getUpdateByExampleSelectiveStatementId

      public String getUpdateByExampleSelectiveStatementId()
    • getUpdateByExampleStatementId

      public String getUpdateByExampleStatementId()
    • getSelectByPrimaryKeyStatementId

      public String getSelectByPrimaryKeyStatementId()
    • getSelectByExampleWithBLOBsStatementId

      public String getSelectByExampleWithBLOBsStatementId()
    • getSelectAllStatementId

      public String getSelectAllStatementId()
    • getSelectByExampleStatementId

      public String getSelectByExampleStatementId()
    • getInsertSelectiveStatementId

      public String getInsertSelectiveStatementId()
    • getInsertStatementId

      public String getInsertStatementId()
    • getDeleteByPrimaryKeyStatementId

      public String getDeleteByPrimaryKeyStatementId()
    • getDeleteByExampleStatementId

      public String getDeleteByExampleStatementId()
    • getCountByExampleStatementId

      public String getCountByExampleStatementId()
    • getMyBatisDynamicSQLTableObjectName

      public String getMyBatisDynamicSQLTableObjectName()
    • setMyBatisDynamicSQLTableObjectName

      public void setMyBatisDynamicSQLTableObjectName(String name)
    • calculateJavaClientInterfacePackage

      protected String calculateJavaClientInterfacePackage()
    • calculateDynamicSqlSupportPackage

      protected String calculateDynamicSqlSupportPackage()
    • calculateJavaClientAttributes

      protected void calculateJavaClientAttributes()
    • calculateJavaModelPackage

      protected String calculateJavaModelPackage()
    • calculateModelAttributes

      protected void calculateModelAttributes()
    • calculateJavaModelExamplePackage

      protected String calculateJavaModelExamplePackage()
      If property exampleTargetPackage specified for example use the specified value, else use default value (targetPackage).
      Returns:
      the calculated package
    • calculateSqlMapPackage

      protected String calculateSqlMapPackage()
    • calculateMyBatis3XmlMapperFileName

      protected String calculateMyBatis3XmlMapperFileName()
    • calculateMyBatis3FallbackSqlMapNamespace

      protected String calculateMyBatis3FallbackSqlMapNamespace()
    • calculateSqlMapFullyQualifiedRuntimeTableName

      protected String calculateSqlMapFullyQualifiedRuntimeTableName()
    • calculateSqlMapAliasedFullyQualifiedRuntimeTableName

      protected String calculateSqlMapAliasedFullyQualifiedRuntimeTableName()
    • getFullyQualifiedTableNameAtRuntime

      public String getFullyQualifiedTableNameAtRuntime()
    • getAliasedFullyQualifiedTableNameAtRuntime

      public String getAliasedFullyQualifiedTableNameAtRuntime()
    • calculateGenerators

      public abstract void calculateGenerators(List<String> warnings, ProgressCallback progressCallback)
      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 warnings
      progressCallback - the progress callback
    • getGeneratedJavaFiles

      public abstract List<GeneratedJavaFile> 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

      public abstract List<GeneratedXmlFile> 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

      public abstract List<GeneratedKotlinFile> 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

      public void setRules(Rules rules)
      This method exists to give plugins the opportunity to replace the calculated rules if necessary.
      Parameters:
      rules - the new rules
    • getTableConfiguration

      public TableConfiguration getTableConfiguration()
    • setPrimaryKeyType

      public void setPrimaryKeyType(String primaryKeyType)
    • setBaseRecordType

      public void setBaseRecordType(String baseRecordType)
    • setKotlinRecordType

      public void setKotlinRecordType(String kotlinRecordType)
    • setRecordWithBLOBsType

      public void setRecordWithBLOBsType(String recordWithBLOBsType)
    • setExampleType

      public void setExampleType(String exampleType)
    • setMyBatis3FallbackSqlMapNamespace

      public void setMyBatis3FallbackSqlMapNamespace(String sqlMapNamespace)
    • setSqlMapFullyQualifiedRuntimeTableName

      public void setSqlMapFullyQualifiedRuntimeTableName(String fullyQualifiedRuntimeTableName)
    • setSqlMapAliasedFullyQualifiedRuntimeTableName

      public void setSqlMapAliasedFullyQualifiedRuntimeTableName(String aliasedFullyQualifiedRuntimeTableName)
    • getMyBatis3XmlMapperPackage

      public String getMyBatis3XmlMapperPackage()
    • setMyBatis3XmlMapperPackage

      public void setMyBatis3XmlMapperPackage(String mybatis3XmlMapperPackage)
    • getMyBatis3XmlMapperFileName

      public String getMyBatis3XmlMapperFileName()
    • setMyBatis3XmlMapperFileName

      public void setMyBatis3XmlMapperFileName(String mybatis3XmlMapperFileName)
    • getMyBatis3JavaMapperType

      public String getMyBatis3JavaMapperType()
    • setMyBatis3JavaMapperType

      public void setMyBatis3JavaMapperType(String mybatis3JavaMapperType)
    • getMyBatis3SqlProviderType

      public String getMyBatis3SqlProviderType()
    • setMyBatis3SqlProviderType

      public void setMyBatis3SqlProviderType(String mybatis3SqlProviderType)
    • getMyBatisDynamicSqlSupportType

      public String getMyBatisDynamicSqlSupportType()
    • setMyBatisDynamicSqlSupportType

      public void setMyBatisDynamicSqlSupportType(String s)
    • getTargetRuntime

      public IntrospectedTable.TargetRuntime 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

      public Context getContext()
    • getRemarks

      public String getRemarks()
    • setRemarks

      public void setRemarks(String remarks)
    • getTableType

      public String getTableType()
    • setTableType

      public void setTableType(String tableType)