public abstract class

IntrospectedTable

extends Object
java.lang.Object
   ↳ org.mybatis.generator.api.IntrospectedTable
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

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.

Summary

Nested Classes
enum IntrospectedTable.InternalAttribute  
enum IntrospectedTable.TargetRuntime  
Fields
protected Map<String, Object> attributes Attributes may be used by plugins to capture table related state between the different plugin calls.
protected List<IntrospectedColumn> baseColumns
protected List<IntrospectedColumn> blobColumns
protected Context context
protected FullyQualifiedTable fullyQualifiedTable
protected Map<IntrospectedTable.InternalAttribute, String> internalAttributes Internal attributes are used to store commonly accessed items by all code generators
protected List<IntrospectedColumn> primaryKeyColumns
protected Rules rules
protected TableConfiguration tableConfiguration
protected IntrospectedTable.TargetRuntime targetRuntime
Public Constructors
IntrospectedTable(IntrospectedTable.TargetRuntime targetRuntime)
Public Methods
void addColumn(IntrospectedColumn introspectedColumn)
void addPrimaryKeyColumn(String columnName)
abstract void calculateGenerators(List<String> warnings, ProgressCallback progressCallback)
This method can be used to initialize the generators before they will be called.
String getAliasedFullyQualifiedTableNameAtRuntime()
List<IntrospectedColumn> getAllColumns()
Returns all columns in the table (for use by the select by primary key and select by example with BLOBs methods)
Object getAttribute(String name)
List<IntrospectedColumn> getBLOBColumns()
String getBaseColumnListId()
List<IntrospectedColumn> getBaseColumns()
String getBaseRecordType()
String getBaseResultMapId()
String getBlobColumnListId()
IntrospectedColumn getColumn(String columnName)
String getCountByExampleStatementId()
String getDAOImplementationType()
String getDAOInterfaceType()
String getDeleteByExampleStatementId()
String getDeleteByPrimaryKeyStatementId()
String getExampleType()
String getExampleWhereClauseId()
FullyQualifiedTable getFullyQualifiedTable()
String getFullyQualifiedTableNameAtRuntime()
abstract List<GeneratedJavaFile> getGeneratedJavaFiles()
This method should return a list of generated Java files related to this table.
GeneratedKey getGeneratedKey()
abstract List<GeneratedXmlFile> getGeneratedXmlFiles()
This method should return a list of generated XML files related to this table.
abstract int getGenerationSteps()
This method should return the number of progress messages that will be send during the generation phase.
String getIbatis2SqlMapFileName()
Calculates an SQL Map file name for the table.
String getIbatis2SqlMapNamespace()
String getIbatis2SqlMapPackage()
Calculates the package for the current table.
String getInsertSelectiveStatementId()
String getInsertStatementId()
String getMyBatis3JavaMapperType()
String getMyBatis3SqlProviderType()
String getMyBatis3UpdateByExampleWhereClauseId()
String getMyBatis3XmlMapperFileName()
String getMyBatis3XmlMapperPackage()
int getNonBLOBColumnCount()
List<IntrospectedColumn> getNonBLOBColumns()
Returns all columns except BLOBs (for use by the select by example without BLOBs method)
List<IntrospectedColumn> getNonPrimaryKeyColumns()
List<IntrospectedColumn> getPrimaryKeyColumns()
Returns the columns in the primary key.
String getPrimaryKeyType()
String getRecordWithBLOBsType()
String getResultMapWithBLOBsId()
Rules getRules()
String getSelectByExampleQueryId()
String getSelectByExampleStatementId()
String getSelectByExampleWithBLOBsStatementId()
String getSelectByPrimaryKeyQueryId()
String getSelectByPrimaryKeyStatementId()
TableConfiguration getTableConfiguration()
String getTableConfigurationProperty(String property)
IntrospectedTable.TargetRuntime getTargetRuntime()
String getUpdateByExampleSelectiveStatementId()
String getUpdateByExampleStatementId()
String getUpdateByExampleWithBLOBsStatementId()
String getUpdateByPrimaryKeySelectiveStatementId()
String getUpdateByPrimaryKeyStatementId()
String getUpdateByPrimaryKeyWithBLOBsStatementId()
boolean hasAnyColumns()
boolean hasBLOBColumns()
boolean hasBaseColumns()
boolean hasJDBCDateColumns()
Returns true if any of the columns in the table are JDBC Dates (as opposed to timestamps).
boolean hasJDBCTimeColumns()
Returns true if any of the columns in the table are JDBC Times (as opposed to timestamps).
boolean hasPrimaryKeyColumns()
void initialize()
boolean isConstructorBased()
boolean isImmutable()
abstract boolean isJava5Targeted()
Denotes whether generated code is targeted for Java version 5.0 or higher.
void removeAttribute(String name)
abstract boolean requiresXMLGenerator()
Should return true if an XML generator is required for this table.
void setAttribute(String name, Object value)
void setBaseColumnListId(String s)
void setBaseRecordType(String baseRecordType)
void setBaseResultMapId(String s)
void setBlobColumnListId(String s)
void setContext(Context context)
void setCountByExampleStatementId(String s)
void setDAOImplementationType(String DAOImplementationType)
void setDAOInterfaceType(String DAOInterfaceType)
void setDeleteByExampleStatementId(String s)
void setDeleteByPrimaryKeyStatementId(String s)
void setExampleType(String exampleType)
void setExampleWhereClauseId(String s)
void setFullyQualifiedTable(FullyQualifiedTable fullyQualifiedTable)
void setIbatis2SqlMapFileName(String sqlMapFileName)
void setIbatis2SqlMapNamespace(String sqlMapNamespace)
void setIbatis2SqlMapPackage(String sqlMapPackage)
void setInsertSelectiveStatementId(String s)
void setInsertStatementId(String s)
void setMyBatis3JavaMapperType(String mybatis3JavaMapperType)
void setMyBatis3SqlProviderType(String mybatis3SqlProviderType)
void setMyBatis3UpdateByExampleWhereClauseId(String s)
void setMyBatis3XmlMapperFileName(String mybatis3XmlMapperFileName)
void setMyBatis3XmlMapperPackage(String mybatis3XmlMapperPackage)
void setPrimaryKeyType(String primaryKeyType)
void setRecordWithBLOBsType(String recordWithBLOBsType)
void setResultMapWithBLOBsId(String s)
void setRules(Rules rules)
This method exists to give plugins the opportunity to replace the calculated rules if necessary.
void setSelectByExampleStatementId(String s)
void setSelectByExampleWithBLOBsStatementId(String s)
void setSelectByPrimaryKeyStatementId(String s)
void setSqlMapAliasedFullyQualifiedRuntimeTableName(String aliasedFullyQualifiedRuntimeTableName)
void setSqlMapFullyQualifiedRuntimeTableName(String fullyQualifiedRuntimeTableName)
void setTableConfiguration(TableConfiguration tableConfiguration)
void setUpdateByExampleSelectiveStatementId(String s)
void setUpdateByExampleStatementId(String s)
void setUpdateByExampleWithBLOBsStatementId(String s)
void setUpdateByPrimaryKeySelectiveStatementId(String s)
void setUpdateByPrimaryKeyStatementId(String s)
void setUpdateByPrimaryKeyWithBLOBsStatementId(String s)
Protected Methods
String calculateIbatis2SqlMapFileName()
String calculateIbatis2SqlMapNamespace()
String calculateIbatis2SqlMapPackage()
void calculateJavaClientAttributes()
String calculateJavaClientImplementationPackage()
String calculateJavaClientInterfacePackage()
String calculateJavaModelPackage()
void calculateModelAttributes()
String calculateMyBatis3XmlMapperFileName()
String calculateSqlMapAliasedFullyQualifiedRuntimeTableName()
String calculateSqlMapFullyQualifiedRuntimeTableName()
void calculateXmlAttributes()
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected Map<String, Object> attributes

Attributes may be used by plugins to capture table related state between the different plugin calls.

protected List<IntrospectedColumn> baseColumns

protected List<IntrospectedColumn> blobColumns

protected Context context

protected FullyQualifiedTable fullyQualifiedTable

protected Map<IntrospectedTable.InternalAttribute, String> internalAttributes

Internal attributes are used to store commonly accessed items by all code generators

protected List<IntrospectedColumn> primaryKeyColumns

protected Rules rules

protected TableConfiguration tableConfiguration

protected IntrospectedTable.TargetRuntime targetRuntime

Public Constructors

public IntrospectedTable (IntrospectedTable.TargetRuntime targetRuntime)

Public Methods

public void addColumn (IntrospectedColumn introspectedColumn)

public void addPrimaryKeyColumn (String columnName)

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.

public String getAliasedFullyQualifiedTableNameAtRuntime ()

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

public Object getAttribute (String name)

public List<IntrospectedColumn> getBLOBColumns ()

public String getBaseColumnListId ()

public List<IntrospectedColumn> getBaseColumns ()

public String getBaseRecordType ()

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.

public String getBaseResultMapId ()

public String getBlobColumnListId ()

public IntrospectedColumn getColumn (String columnName)

public String getCountByExampleStatementId ()

public String getDAOImplementationType ()

public String getDAOInterfaceType ()

public String getDeleteByExampleStatementId ()

public String getDeleteByPrimaryKeyStatementId ()

public String getExampleType ()

Returns
  • the type for the example class.

public String getExampleWhereClauseId ()

public FullyQualifiedTable getFullyQualifiedTable ()

public String getFullyQualifiedTableNameAtRuntime ()

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

public GeneratedKey getGeneratedKey ()

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

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

public String getIbatis2SqlMapFileName ()

Calculates an SQL Map file name for the table. Typically the name is "XXXX_SqlMap.xml" where XXXX is the fully qualified table name (delimited with underscores).

Returns
  • the name of the SqlMap file

public String getIbatis2SqlMapNamespace ()

public String getIbatis2SqlMapPackage ()

Calculates the package for the current table.

Returns
  • the package for the SqlMap for the current table

public String getInsertSelectiveStatementId ()

public String getInsertStatementId ()

public String getMyBatis3JavaMapperType ()

public String getMyBatis3SqlProviderType ()

public String getMyBatis3UpdateByExampleWhereClauseId ()

public String getMyBatis3XmlMapperFileName ()

public String getMyBatis3XmlMapperPackage ()

public int getNonBLOBColumnCount ()

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

public List<IntrospectedColumn> getNonPrimaryKeyColumns ()

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

public String getPrimaryKeyType ()

public String getRecordWithBLOBsType ()

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.

public String getResultMapWithBLOBsId ()

public Rules getRules ()

public String getSelectByExampleQueryId ()

public String getSelectByExampleStatementId ()

public String getSelectByExampleWithBLOBsStatementId ()

public String getSelectByPrimaryKeyQueryId ()

public String getSelectByPrimaryKeyStatementId ()

public TableConfiguration getTableConfiguration ()

public String getTableConfigurationProperty (String property)

public IntrospectedTable.TargetRuntime getTargetRuntime ()

public String getUpdateByExampleSelectiveStatementId ()

public String getUpdateByExampleStatementId ()

public String getUpdateByExampleWithBLOBsStatementId ()

public String getUpdateByPrimaryKeySelectiveStatementId ()

public String getUpdateByPrimaryKeyStatementId ()

public String getUpdateByPrimaryKeyWithBLOBsStatementId ()

public boolean hasAnyColumns ()

public boolean hasBLOBColumns ()

public boolean hasBaseColumns ()

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

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

public boolean hasPrimaryKeyColumns ()

public void initialize ()

public boolean isConstructorBased ()

public boolean isImmutable ()

public abstract boolean isJava5Targeted ()

Denotes whether generated code is targeted for Java version 5.0 or higher.

Returns
  • true if the generated code makes use of Java5 features

public void removeAttribute (String name)

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.

public void setAttribute (String name, Object value)

public void setBaseColumnListId (String s)

public void setBaseRecordType (String baseRecordType)

public void setBaseResultMapId (String s)

public void setBlobColumnListId (String s)

public void setContext (Context context)

public void setCountByExampleStatementId (String s)

public void setDAOImplementationType (String DAOImplementationType)

public void setDAOInterfaceType (String DAOInterfaceType)

public void setDeleteByExampleStatementId (String s)

public void setDeleteByPrimaryKeyStatementId (String s)

public void setExampleType (String exampleType)

public void setExampleWhereClauseId (String s)

public void setFullyQualifiedTable (FullyQualifiedTable fullyQualifiedTable)

public void setIbatis2SqlMapFileName (String sqlMapFileName)

public void setIbatis2SqlMapNamespace (String sqlMapNamespace)

public void setIbatis2SqlMapPackage (String sqlMapPackage)

public void setInsertSelectiveStatementId (String s)

public void setInsertStatementId (String s)

public void setMyBatis3JavaMapperType (String mybatis3JavaMapperType)

public void setMyBatis3SqlProviderType (String mybatis3SqlProviderType)

public void setMyBatis3UpdateByExampleWhereClauseId (String s)

public void setMyBatis3XmlMapperFileName (String mybatis3XmlMapperFileName)

public void setMyBatis3XmlMapperPackage (String mybatis3XmlMapperPackage)

public void setPrimaryKeyType (String primaryKeyType)

public void setRecordWithBLOBsType (String recordWithBLOBsType)

public void setResultMapWithBLOBsId (String s)

public void setRules (Rules rules)

This method exists to give plugins the opportunity to replace the calculated rules if necessary.

public void setSelectByExampleStatementId (String s)

public void setSelectByExampleWithBLOBsStatementId (String s)

public void setSelectByPrimaryKeyStatementId (String s)

public void setSqlMapAliasedFullyQualifiedRuntimeTableName (String aliasedFullyQualifiedRuntimeTableName)

public void setSqlMapFullyQualifiedRuntimeTableName (String fullyQualifiedRuntimeTableName)

public void setTableConfiguration (TableConfiguration tableConfiguration)

public void setUpdateByExampleSelectiveStatementId (String s)

public void setUpdateByExampleStatementId (String s)

public void setUpdateByExampleWithBLOBsStatementId (String s)

public void setUpdateByPrimaryKeySelectiveStatementId (String s)

public void setUpdateByPrimaryKeyStatementId (String s)

public void setUpdateByPrimaryKeyWithBLOBsStatementId (String s)

Protected Methods

protected String calculateIbatis2SqlMapFileName ()

protected String calculateIbatis2SqlMapNamespace ()

protected String calculateIbatis2SqlMapPackage ()

protected void calculateJavaClientAttributes ()

protected String calculateJavaClientImplementationPackage ()

protected String calculateJavaClientInterfacePackage ()

protected String calculateJavaModelPackage ()

protected void calculateModelAttributes ()

protected String calculateMyBatis3XmlMapperFileName ()

protected String calculateSqlMapAliasedFullyQualifiedRuntimeTableName ()

protected String calculateSqlMapFullyQualifiedRuntimeTableName ()

protected void calculateXmlAttributes ()