本文整理匯總了Java中org.apache.velocity.Template.initDocument方法的典型用法代碼示例。如果您正苦於以下問題:Java Template.initDocument方法的具體用法?Java Template.initDocument怎麽用?Java Template.initDocument使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.velocity.Template
的用法示例。
在下文中一共展示了Template.initDocument方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: create
import org.apache.velocity.Template; //導入方法依賴的package包/類
public static Template create(String source, String templateName) throws ParseException {
RuntimeServices runtimeServices = RuntimeSingleton.getRuntimeServices();
StringReader reader = new StringReader(source);
SimpleNode node = runtimeServices.parse(reader, templateName);
Template template = new Template();
template.setRuntimeServices(runtimeServices);
template.setData(node);
template.initDocument();
return template;
}
示例2: VelocitySqlSource
import org.apache.velocity.Template; //導入方法依賴的package包/類
public VelocitySqlSource(Configuration configuration, String scriptText) {
this.configuration = configuration;
try {
RuntimeServices runtimeServices = RuntimeSingleton.getRuntimeServices();
StringReader reader = new StringReader(scriptText);
SimpleNode node = runtimeServices.parse(reader, "Template name");
script = new Template();
script.setRuntimeServices(runtimeServices);
script.setData(node);
script.initDocument();
} catch (Exception ex) {
throw new BuilderException("Error parsing velocity script", ex);
}
}
示例3: createTemplate
import org.apache.velocity.Template; //導入方法依賴的package包/類
/**
* @작성자 : KYJ
* @작성일 : 2017. 10. 14.
* @param url
* @return
* @throws Exception
*/
public static Template createTemplate(InputStream is) throws Exception {
String readFileToString = ValueUtil.toString(is);
RuntimeServices runtimeServices = RuntimeSingleton.getRuntimeServices();
StringReader reader = new StringReader(readFileToString);
SimpleNode node = runtimeServices.parse(reader, "URLTemplate");
Template template = new Template();
template.setRuntimeServices(runtimeServices);
template.setData(node);
template.initDocument();
return template;
}
示例4: create
import org.apache.velocity.Template; //導入方法依賴的package包/類
public static Template create(String source, String templateName) throws ParseException {
RuntimeServices runtimeServices = RuntimeSingleton.getRuntimeServices();
StringReader reader = new StringReader(source);
SimpleNode node = runtimeServices.parse(reader, templateName);
Template template = new Template();
template.setRuntimeServices(runtimeServices);
template.setData(node);
template.initDocument();
return template;
}