Search in sources :

Example 11 with Plugin

use of org.mybatis.generator.api.Plugin in project generator by mybatis.

the class Context method generateFiles.

public void generateFiles(ProgressCallback callback, List<GeneratedJavaFile> generatedJavaFiles, List<GeneratedXmlFile> generatedXmlFiles, List<GeneratedKotlinFile> generatedKotlinFiles, List<String> warnings) throws InterruptedException {
    pluginAggregator = new PluginAggregator();
    for (PluginConfiguration pluginConfiguration : pluginConfigurations) {
        Plugin plugin = ObjectFactory.createPlugin(this, pluginConfiguration);
        if (plugin.validate(warnings)) {
            pluginAggregator.addPlugin(plugin);
        } else {
            warnings.add(getString(// $NON-NLS-1$
            "Warning.24", pluginConfiguration.getConfigurationType(), id));
        }
    }
    // items in the configuration.
    for (IntrospectedTable introspectedTable : introspectedTables) {
        callback.checkCancel();
        introspectedTable.initialize();
        introspectedTable.calculateGenerators(warnings, callback);
    }
    for (IntrospectedTable introspectedTable : introspectedTables) {
        callback.checkCancel();
        generatedJavaFiles.addAll(introspectedTable.getGeneratedJavaFiles());
        generatedXmlFiles.addAll(introspectedTable.getGeneratedXmlFiles());
        generatedKotlinFiles.addAll(introspectedTable.getGeneratedKotlinFiles());
        generatedJavaFiles.addAll(pluginAggregator.contextGenerateAdditionalJavaFiles(introspectedTable));
        generatedXmlFiles.addAll(pluginAggregator.contextGenerateAdditionalXmlFiles(introspectedTable));
        generatedKotlinFiles.addAll(pluginAggregator.contextGenerateAdditionalKotlinFiles(introspectedTable));
    }
    generatedJavaFiles.addAll(pluginAggregator.contextGenerateAdditionalJavaFiles());
    generatedXmlFiles.addAll(pluginAggregator.contextGenerateAdditionalXmlFiles());
    generatedKotlinFiles.addAll(pluginAggregator.contextGenerateAdditionalKotlinFiles());
}
Also used : PluginAggregator(org.mybatis.generator.internal.PluginAggregator) IntrospectedTable(org.mybatis.generator.api.IntrospectedTable) Plugin(org.mybatis.generator.api.Plugin)

Aggregations

Plugin (org.mybatis.generator.api.Plugin)11 ArrayList (java.util.ArrayList)8 CommentGenerator (org.mybatis.generator.api.CommentGenerator)8 FullyQualifiedTable (org.mybatis.generator.api.FullyQualifiedTable)8 IntrospectedColumn (org.mybatis.generator.api.IntrospectedColumn)8 CompilationUnit (org.mybatis.generator.api.dom.java.CompilationUnit)8 Field (org.mybatis.generator.api.dom.java.Field)8 Method (org.mybatis.generator.api.dom.java.Method)8 TopLevelClass (org.mybatis.generator.api.dom.java.TopLevelClass)8 Messages.getString (org.mybatis.generator.internal.util.messages.Messages.getString)8 JavaBeansUtil.getJavaBeansField (org.mybatis.generator.internal.util.JavaBeansUtil.getJavaBeansField)7 FullyQualifiedJavaType (org.mybatis.generator.api.dom.java.FullyQualifiedJavaType)6 IntrospectedTable (org.mybatis.generator.api.IntrospectedTable)2 PluginAggregator (org.mybatis.generator.internal.PluginAggregator)2