public abstract class AbstractTemplate extends Object implements Template
Modifier and Type | Field and Description |
---|---|
protected TemplateEngine |
templateEngine |
Constructor and Description |
---|
AbstractTemplate() |
Modifier and Type | Method and Description |
---|---|
void |
addImport(Object importPath) |
void |
addMacro(Macro macro) |
String |
getAbsolutePath() |
List<String> |
getImportPathList()
返回宏文件中引入模板的顺序
|
long |
getLastModifiedTime() |
Map<String,Macro> |
getMacroMap()
返回宏的内容
|
TemplateContext |
getTemplateContext()
返回上下文
|
TemplateEngine |
getTemplateEngine()
返回模板引擎
|
Object |
put(String key,
Object value)
向上下文放置内容
|
void |
render() |
void |
render(TemplateContext context) |
void |
render(TemplateContext context,
OutputStream outputStream)
进行渲染
|
protected abstract void |
renderContent(TemplateContext context,
OutputStream outputStream) |
void |
setAbsolutePath(String path) |
void |
setLastModifiedTime(long time) |
void |
setTemplateEngine(TemplateEngine templateEngine)
设置对应的模板引擎
|
protected TemplateEngine templateEngine
public TemplateEngine getTemplateEngine()
Template
getTemplateEngine
in interface Template
public void setTemplateEngine(TemplateEngine templateEngine)
Template
setTemplateEngine
in interface Template
public List<String> getImportPathList()
Template
getImportPathList
in interface Template
public void addMacro(Macro macro)
public Map<String,Macro> getMacroMap()
Template
getMacroMap
in interface Template
public void render(TemplateContext context, OutputStream outputStream) throws TemplateException
Template
render
in interface Template
TemplateException
public void render(TemplateContext context) throws TemplateException
render
in interface Template
TemplateException
public void render() throws TemplateException
render
in interface Template
TemplateException
protected abstract void renderContent(TemplateContext context, OutputStream outputStream) throws IOException, TemplateException
IOException
TemplateException
public TemplateContext getTemplateContext()
TemplateContextOperator
getTemplateContext
in interface TemplateContextOperator
public Object put(String key, Object value)
TemplateContextOperator
put
in interface TemplateContextOperator
public long getLastModifiedTime()
getLastModifiedTime
in interface Updatable
public void setLastModifiedTime(long time)
setLastModifiedTime
in interface Updatable
public String getAbsolutePath()
getAbsolutePath
in interface Updatable
public void setAbsolutePath(String path)
setAbsolutePath
in interface Updatable
Copyright © 2006–2018 TinyGroup. All rights reserved.