类 AbstractTemplateEngine

java.lang.Object
com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine
直接已知子类:
BeetlTemplateEngine, EnjoyTemplateEngine, FreemarkerTemplateEngine, VelocityTemplateEngine

public abstract class AbstractTemplateEngine extends Object
模板引擎抽象类
从以下版本开始:
2018-01-10
作者:
hubin
  • 字段详细资料

    • LOGGER

      protected final org.slf4j.Logger LOGGER
  • 构造器详细资料

    • AbstractTemplateEngine

      public AbstractTemplateEngine()
  • 方法详细资料

    • init

      @NotNull public abstract @NotNull AbstractTemplateEngine init(@NotNull @NotNull ConfigBuilder configBuilder)
      模板引擎初始化
    • outputCustomFile

      protected void outputCustomFile(@NotNull @NotNull List<CustomFile> customFiles, @NotNull @NotNull TableInfo tableInfo, @NotNull @NotNull Map<String,Object> objectMap)
      输出自定义模板文件
      参数:
      customFiles - 自定义模板文件列表
      tableInfo - 表信息
      objectMap - 渲染数据
      从以下版本开始:
      3.5.3
    • outputEntity

      protected void outputEntity(@NotNull @NotNull TableInfo tableInfo, @NotNull @NotNull Map<String,Object> objectMap)
      输出实体文件
      参数:
      tableInfo - 表信息
      objectMap - 渲染数据
      从以下版本开始:
      3.5.0
    • getOutputFile

      protected File getOutputFile(String filePath, OutputFile outputFile)
    • outputMapper

      protected void outputMapper(@NotNull @NotNull TableInfo tableInfo, @NotNull @NotNull Map<String,Object> objectMap)
      输出Mapper文件(含xml)
      参数:
      tableInfo - 表信息
      objectMap - 渲染数据
      从以下版本开始:
      3.5.0
    • outputService

      protected void outputService(@NotNull @NotNull TableInfo tableInfo, @NotNull @NotNull Map<String,Object> objectMap)
      输出service文件
      参数:
      tableInfo - 表信息
      objectMap - 渲染数据
      从以下版本开始:
      3.5.0
    • outputController

      protected void outputController(@NotNull @NotNull TableInfo tableInfo, @NotNull @NotNull Map<String,Object> objectMap)
      输出controller文件
      参数:
      tableInfo - 表信息
      objectMap - 渲染数据
      从以下版本开始:
      3.5.0
    • outputFile

      protected void outputFile(@NotNull @NotNull File file, @NotNull @NotNull Map<String,Object> objectMap, @NotNull @NotNull String templatePath, boolean fileOverride)
      输出文件
      参数:
      file - 文件
      objectMap - 渲染信息
      templatePath - 模板路径
      fileOverride - 是否覆盖已有文件
      从以下版本开始:
      3.5.2
    • getTemplateFilePath

      @NotNull @Deprecated protected @NotNull Optional<String> getTemplateFilePath(@NotNull @NotNull Function<TemplateConfig,String> function)
      已过时。
      3.5.6
      获取模板路径
      参数:
      function - function
      返回:
      模板路径
      从以下版本开始:
      3.5.0
    • getPathInfo

      @Nullable protected @Nullable String getPathInfo(@NotNull @NotNull OutputFile outputFile)
      获取路径信息
      参数:
      outputFile - 输出文件
      返回:
      路径信息
    • batchOutput

      @NotNull public @NotNull AbstractTemplateEngine batchOutput()
      批量输出 java xml 文件
    • writer

      public abstract String writer(@NotNull @NotNull Map<String,Object> objectMap, @NotNull @NotNull String templateName, @NotNull @NotNull String templateString) throws Exception
      将模板转化成为字符串
      参数:
      objectMap - 渲染对象 MAP 信息
      templateName - 模板名称
      templateString - 模板字符串
      抛出:
      Exception
      从以下版本开始:
      3.5.0
    • writer

      public abstract void writer(@NotNull @NotNull Map<String,Object> objectMap, @NotNull @NotNull String templatePath, @NotNull @NotNull File outputFile) throws Exception
      将模板转化成为文件
      参数:
      objectMap - 渲染对象 MAP 信息
      templatePath - 模板文件
      outputFile - 文件生成的目录
      抛出:
      Exception - 异常
      从以下版本开始:
      3.5.0
    • open

      public void open()
      打开输出目录
    • getObjectMap

      @NotNull public @NotNull Map<String,Object> getObjectMap(@NotNull @NotNull ConfigBuilder config, @NotNull @NotNull TableInfo tableInfo)
      渲染对象 MAP 信息
      参数:
      config - 配置信息
      tableInfo - 表信息对象
      返回:
      ignore
    • templateFilePath

      @NotNull public abstract @NotNull String templateFilePath(@NotNull @NotNull String filePath)
      模板真实文件路径
      参数:
      filePath - 文件路径
      返回:
      ignore
    • isCreate

      protected boolean isCreate(@NotNull @NotNull File file, boolean fileOverride)
      检查文件是否创建文件
      参数:
      file - 文件
      fileOverride - 是否覆盖已有文件
      返回:
      是否创建文件
      从以下版本开始:
      3.5.2
    • suffixJavaOrKt

      protected String suffixJavaOrKt()
      文件后缀
    • getConfigBuilder

      @NotNull public @NotNull ConfigBuilder getConfigBuilder()
    • setConfigBuilder

      @NotNull public @NotNull AbstractTemplateEngine setConfigBuilder(@NotNull @NotNull ConfigBuilder configBuilder)