All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.ofofs.plugins.FileHeaderPlugin Maven / Gradle / Ivy

The newest version!
package com.github.ofofs.plugins;

import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.PluginAdapter;
import org.mybatis.generator.api.dom.java.Interface;
import org.mybatis.generator.api.dom.java.TopLevelClass;

import java.util.List;

/**
 * @author kyg
 */
public class FileHeaderPlugin extends PluginAdapter {

    public boolean validate(List warnings) {
        return true;
    }

    @Override
    public boolean modelBaseRecordClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
        genJavaDocs(topLevelClass.getJavaDocLines());
        return true;
    }

    @Override
    public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
        genJavaDocs(interfaze.getJavaDocLines());
        return true;
    }

    /**
     * 生成Java文档注释
     *
     * @param javaDocLines
     */
    private void genJavaDocs(List javaDocLines) {
        javaDocLines.add("/**");
        javaDocLines.add(" * @author " + properties.getProperty("author", "mbg"));
        javaDocLines.add(" */");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy