Package org.mybatis.generator.config
Class Context
java.lang.Object
org.mybatis.generator.config.PropertyHolder
org.mybatis.generator.config.Context
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPluginConfiguration
(PluginConfiguration pluginConfiguration) void
addProperty
(String name, String value) void
boolean
void
closeConnection
(Connection connection) This method closes a JDBC connection and ignores any errors.void
generateFiles
(ProgressCallback callback, List<GeneratedJavaFile> generatedJavaFiles, List<GeneratedXmlFile> generatedXmlFiles, List<GeneratedKotlinFile> generatedKotlinFiles, List<GeneratedFile> otherGeneratedFiles, List<String> warnings) This method creates a new JDBC connection from the values specified in the configuration file.int
getId()
This method could be useful for users that use the library for introspection only and not for code generation.int
void
introspectTables
(ProgressCallback callback, List<String> warnings, Set<String> fullyQualifiedTableNames) Introspect tables based on the configuration specified in the constructor.void
setCommentGeneratorConfiguration
(CommentGeneratorConfiguration commentGeneratorConfiguration) void
setConnectionFactoryConfiguration
(ConnectionFactoryConfiguration connectionFactoryConfiguration) void
void
setIntrospectedColumnImpl
(String introspectedColumnImpl) void
setJavaClientGeneratorConfiguration
(JavaClientGeneratorConfiguration javaClientGeneratorConfiguration) void
setJavaModelGeneratorConfiguration
(JavaModelGeneratorConfiguration javaModelGeneratorConfiguration) void
setJavaTypeResolverConfiguration
(JavaTypeResolverConfiguration javaTypeResolverConfiguration) void
setJdbcConnectionConfiguration
(JDBCConnectionConfiguration jdbcConnectionConfiguration) void
setSqlMapGeneratorConfiguration
(SqlMapGeneratorConfiguration sqlMapGeneratorConfiguration) void
setTargetRuntime
(String targetRuntime) void
This method does a simple validate, it makes sure that all required fields have been filled in.Methods inherited from class org.mybatis.generator.config.PropertyHolder
getProperties, getProperty
-
Constructor Details
-
Context
-
-
Method Details
-
addTableConfiguration
-
getJavaClientGeneratorConfiguration
-
getJavaModelGeneratorConfiguration
-
getJavaTypeResolverConfiguration
-
getSqlMapGeneratorConfiguration
-
addPluginConfiguration
-
validate
This method does a simple validate, it makes sure that all required fields have been filled in. It does not do any more complex operations such as validating that database tables exist or validating that named columns exist- Parameters:
errors
- the errors
-
getId
-
setId
-
setJavaClientGeneratorConfiguration
public void setJavaClientGeneratorConfiguration(JavaClientGeneratorConfiguration javaClientGeneratorConfiguration) -
setJavaModelGeneratorConfiguration
public void setJavaModelGeneratorConfiguration(JavaModelGeneratorConfiguration javaModelGeneratorConfiguration) -
setJavaTypeResolverConfiguration
public void setJavaTypeResolverConfiguration(JavaTypeResolverConfiguration javaTypeResolverConfiguration) -
setJdbcConnectionConfiguration
-
setSqlMapGeneratorConfiguration
public void setSqlMapGeneratorConfiguration(SqlMapGeneratorConfiguration sqlMapGeneratorConfiguration) -
getDefaultModelType
-
getBeginningDelimiter
-
getEndingDelimiter
-
addProperty
- Overrides:
addProperty
in classPropertyHolder
-
getCommentGenerator
-
getJavaFormatter
-
getKotlinFormatter
-
getXmlFormatter
-
getCommentGeneratorConfiguration
-
setCommentGeneratorConfiguration
public void setCommentGeneratorConfiguration(CommentGeneratorConfiguration commentGeneratorConfiguration) -
getPlugins
-
getTargetRuntime
-
setTargetRuntime
-
getIntrospectedColumnImpl
-
setIntrospectedColumnImpl
-
getIntrospectedTables
This method could be useful for users that use the library for introspection only and not for code generation.- Returns:
- a list containing the results of table introspection. The list will be empty if this method is called before introspectTables(), or if no tables are found that match the configuration
-
getIntrospectionSteps
public int getIntrospectionSteps() -
introspectTables
public void introspectTables(ProgressCallback callback, List<String> warnings, Set<String> fullyQualifiedTableNames) throws SQLException, InterruptedException Introspect tables based on the configuration specified in the constructor. This method is long running.- Parameters:
callback
- a progress callback if progress information is desired, ornull
warnings
- any warning generated from this method will be added to the List. Warnings are always Strings.fullyQualifiedTableNames
- a set of table names to generate. The elements of the set must be Strings that exactly match what's specified in the configuration. For example, if table name = "foo" and schema = "bar", then the fully qualified table name is "foo.bar". If the Set is null or empty, then all tables in the configuration will be used for code generation.- Throws:
SQLException
- if some error arises while introspecting the specified database tables.InterruptedException
- if the progress callback reports a cancel
-
getGenerationSteps
public int getGenerationSteps() -
generateFiles
public void generateFiles(ProgressCallback callback, List<GeneratedJavaFile> generatedJavaFiles, List<GeneratedXmlFile> generatedXmlFiles, List<GeneratedKotlinFile> generatedKotlinFiles, List<GeneratedFile> otherGeneratedFiles, List<String> warnings) throws InterruptedException - Throws:
InterruptedException
-
getConnection
This method creates a new JDBC connection from the values specified in the configuration file. If you call this method, then you are responsible for closing the connection (SeecloseConnection(Connection)
). If you do not close the connection, then there could be connection leaks.- Returns:
- a new connection created from the values in the configuration file
- Throws:
SQLException
- if any error occurs while creating the connection
-
closeConnection
This method closes a JDBC connection and ignores any errors. If the passed connection is null, then the method does nothing.- Parameters:
connection
- a JDBC connection to close, may be null
-
autoDelimitKeywords
public boolean autoDelimitKeywords() -
getConnectionFactoryConfiguration
-
setConnectionFactoryConfiguration
public void setConnectionFactoryConfiguration(ConnectionFactoryConfiguration connectionFactoryConfiguration)
-