public abstract class BaseTemplate extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected String |
fileNameReg |
protected String |
filePath
生成的文件路径
|
protected OutputDir |
outputDir |
protected String |
template
模板内容
|
| 构造器和说明 |
|---|
BaseTemplate(String template,
String fileNameReg) |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
getConfig(Map<String,Object> context,
String key,
String _default)
从context中获取ongl配置值
|
protected String |
getFileName(TableSetter table) |
protected String |
getPackage(TableSetter table) |
abstract String |
getTemplateId()
模板code
|
void |
initContext(TableSetter table,
Map<String,Object> parent,
Map<String,Object> ctx)
使用表信息初始化模板变量
|
protected String |
replace(String str,
Map<String,Object> context,
String... vars)
替换变量 ${entity}, ${query}, ${update}
|
protected abstract void |
templateConfigs(TableSetter table,
Map<String,Object> parent,
Map<String,Object> ctx)
模板自身的配置项
|
protected String template
protected String filePath
protected String fileNameReg
protected OutputDir outputDir
public final void initContext(TableSetter table, Map<String,Object> parent, Map<String,Object> ctx)
table - public abstract String getTemplateId()
protected abstract void templateConfigs(TableSetter table, Map<String,Object> parent, Map<String,Object> ctx)
table - ctx - 模板自身构建的上下文protected String getFileName(TableSetter table)
protected String getPackage(TableSetter table)
public static String getConfig(Map<String,Object> context, String key, String _default)
context - 上下文key - ongl表达式 key1.key2_default - 默认值Copyright © 2020. All rights reserved.