template = new Template(SmartyResult.getEngine(), text);
names = objects;
}
public String parse(Map<String, Object> map) throws Exception {
Context context = new Context();
context.putAll(map);
// 进行临时的输出, 成功才真正的返回得到的结果
StringWriter out = new StringWriter();
template.merge(context, out);
// 回写指定的参数
if (names != null) {
for (String name : names) {
map.put(name, context.get(name));
}
}
return out.toString();
}