public class Context extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
boolean |
byteOutputMode
输出模式
|
ByteWriter |
byteWriter
采用的输出流
|
Map<String,Object> |
globalVar
全局变量
|
short |
gotoFlag
0 正常语句,继续执行,1 continue,2 break,3 return;
|
GroupTemplate |
gt
模板组
|
boolean |
isInit |
ContextBuffer |
localBuffer
一个字符和字节的buffer
|
static Object |
NOT_EXIST_OBJECT |
boolean |
safeOutput
当前所有变量是否都是安全输出
|
Object[] |
staticTextArray
这些变量来自于ProgrameMeta,模板的静态文本,TODO,能否改成SoftRefernce,避免占用较大内存?
|
Template |
template
当前模板
|
int |
tempVarStartIndex
临时变量开始计数的位置
|
Object[] |
vars
当前会话相关变量全局变量和临时变量都放在数组里,全局变量放在前面,Beetl并没有使用Map来存放变量名和值,世为了提高性能
|
| 限定符 | 构造器和说明 |
|---|---|
protected |
Context(GroupTemplate gt) |
protected |
Context(GroupTemplate gt,
ContextBuffer buffer) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
completed() |
void |
destory() |
protected boolean |
exist(int i)
判断全局变量是否存在
|
Tag |
getCurrentTag() |
Object |
getGlobal(String key)
得到全局变量
|
Resource |
getResource()
当前处于哪个Resource
|
String |
getResourceId() |
void |
set(String key,
Object value)
设置全局变量
|
void |
setCurrentTag(Tag tag) |
public static Object NOT_EXIST_OBJECT
public ByteWriter byteWriter
public Template template
public GroupTemplate gt
public boolean byteOutputMode
public Object[] vars
public Object[] staticTextArray
public int tempVarStartIndex
public short gotoFlag
public boolean isInit
public boolean safeOutput
public ContextBuffer localBuffer
protected Context(GroupTemplate gt)
protected Context(GroupTemplate gt, ContextBuffer buffer)
public void completed()
protected boolean exist(int i)
i - public String getResourceId()
public Resource getResource()
public void setCurrentTag(Tag tag)
public Tag getCurrentTag()
public void destory()
Copyright © 2019. All rights reserved.