Package org.mybatis.generator.api
Class MyBatisGenerator
java.lang.Object
org.mybatis.generator.api.MyBatisGenerator
This class is the main interface to MyBatis generator. A typical execution of the tool involves these steps:
- Create a Configuration object. The Configuration can be the result of a parsing the XML configuration file, or it can be created solely in Java.
- Create a MyBatisGenerator object
- Call one of the generate() methods
- Author:
- Jeff Butler
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionThis is one of the main methods for generating code.This is one of the main methods for generating code.Returns the list of generated generic files after a call to one of the generate methods.Returns the list of generated Java files after a call to one of the generate methods.Returns the list of generated Kotlin files after a call to one of the generate methods.Returns the list of generated XML files after a call to one of the generate methods.
-
Method Details
-
generateOnly
public List<String> generateOnly() throws SQLException, InterruptedException, InvalidConfigurationExceptionThis is one of the main methods for generating code. This method is long-running, but progress can be provided and the method can be canceled through the ProgressCallback interface. This method will not write results to the disk. The generated objects can be retrieved from the getGeneratedJavaFiles(), getGeneratedKotlinFiles(), getGeneratedXmlFiles(), and getGeneratedGenericFiles() methods.- Returns:
- any warnings created during the generation process
- Throws:
SQLException- the SQL exceptionInterruptedException- if the method is canceled through the ProgressCallbackInvalidConfigurationException- if the specified configuration is invalid
-
generateAndWrite
public List<String> generateAndWrite() throws SQLException, IOException, InterruptedException, InvalidConfigurationExceptionThis is one of the main methods for generating code. This method is long-running, but progress can be provided and the method can be canceled through the ProgressCallback interface. This method will write results to the disk.- Returns:
- any warnings created during the generation process
- Throws:
SQLException- the SQL exceptionIOException- Signals that an I/O exception has occurred.InterruptedException- if the method is canceled through the ProgressCallbackInvalidConfigurationException- if the specified configuration is invalid
-
getGeneratedJavaFiles
Returns the list of generated Java files after a call to one of the generate methods. This is useful if you prefer to process the generated files yourself and do not want the generator to write them to disk.- Returns:
- the list of generated Java files
-
getGeneratedKotlinFiles
Returns the list of generated Kotlin files after a call to one of the generate methods. This is useful if you prefer to process the generated files yourself and do not want the generator to write them to disk.- Returns:
- the list of generated Kotlin files
-
getGeneratedXmlFiles
Returns the list of generated XML files after a call to one of the generate methods. This is useful if you prefer to process the generated files yourself and do not want the generator to write them to disk.- Returns:
- the list of generated XML files
-
getGeneratedGenericFiles
Returns the list of generated generic files after a call to one of the generate methods. This is useful if you prefer to process the generated files yourself and do not want the generator to write them to disk.The list will be empty unless you have used a plugin that generates generic files or are using a custom runtime.
- Returns:
- the list of generated generic files
-