• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SimpleNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.velocity.runtime.parser.node.SimpleNode的典型用法代码示例。如果您正苦于以下问题:Java SimpleNode类的具体用法?Java SimpleNode怎么用?Java SimpleNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SimpleNode类属于org.apache.velocity.runtime.parser.node包,在下文中一共展示了SimpleNode类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: renderString

import org.apache.velocity.runtime.parser.node.SimpleNode; //导入依赖的package包/类
@Override
public void renderString(String templateContent, Map<String, Object> model, Writer writer) {
    // create the velocity context
    VelocityContext context = createVelocityContext(model);

    // merge the template
    try {
        RuntimeServices runtimeServices = RuntimeSingleton.getRuntimeServices();
        StringReader reader = new StringReader(templateContent);
        SimpleNode node = runtimeServices.parse(reader, "StringTemplate");
        Template template = new Template();
        template.setRuntimeServices(runtimeServices);
        template.setData(node);
        template.initDocument();
        template.merge(context, writer);
    } catch (Exception e) {
        throw new PippoRuntimeException(e);
    }
}
 
开发者ID:decebals,项目名称:pippo,代码行数:20,代码来源:VelocityTemplateEngine.java


示例2: render

import org.apache.velocity.runtime.parser.node.SimpleNode; //导入依赖的package包/类
@Override
public boolean render(InternalContextAdapter context, Writer writer,
		Node node) throws IOException, ResourceNotFoundException,
		ParseErrorException, MethodInvocationException 
{
	int argsNum = node.jjtGetNumChildren();
	for(int step = 0 ; step < argsNum; step++)
	{
		SimpleNode simpleNode = (SimpleNode) node.jjtGetChild(step);

		Object argObject = simpleNode.value(context);

		//传入参数
		if(argObject instanceof String)
		{
			System.out.println((String)argObject);
			writer.write((String)argObject);
			writer.flush();
		}
	}
	return true;
}
 
开发者ID:GooDay0923,项目名称:java-framework-with-springmvc-mybatis-proxool,代码行数:23,代码来源:TestDirective.java


示例3: mergeTemplateIntoString

import org.apache.velocity.runtime.parser.node.SimpleNode; //导入依赖的package包/类
public String mergeTemplateIntoString(String templateFilename, Map<String, Object> params)
        throws VelocityTemplateParsingException {
    try (InputStream is = settingsFacade.getRawConfig(templateFilename)) {
        StringReader reader = new StringReader(IOUtils.toString(is));
        SimpleNode node = rs.parse(reader, templateFilename);

        Template template = new Template();
        template.setRuntimeServices(rs);
        template.setData(node);
        template.initDocument();

        StringWriter writer = new StringWriter();
        template.merge(new VelocityContext(params), writer);
        return writer.toString();
    } catch (ParseException|IOException e) {
        throw new VelocityTemplateParsingException("Couldn't merge template into string", e);
    }
}
 
开发者ID:motech,项目名称:motech,代码行数:19,代码来源:VelocityTemplateParser.java


示例4: initTemplate

import org.apache.velocity.runtime.parser.node.SimpleNode; //导入依赖的package包/类
private void initTemplate(@NonNull final String verifyExpression) throws ParseException {

        // Init pattern ...
        final RuntimeServices runtimeServices = RuntimeSingleton.getRuntimeServices();

        final StringReader reader = new StringReader(verifyExpression);
        SimpleNode node = runtimeServices.parse(reader, this.getDocumentation().getId());

        final Template template = new Template();
        template.setRuntimeServices(runtimeServices);
        template.setData(node);
        template.initDocument();
        this.template = template;

        // Parse expression looking for variable ...
        final Pattern pattern = Pattern.compile(VELOCITY_VARIABLE);
        final Matcher matcher = pattern.matcher(verifyExpression);

        while (matcher.find()) {
            final String key = matcher.group(1);
            final ClassProperty property = ClassProperty.to(key);
            this.templateProperties.add(property);
        }

    }
 
开发者ID:mulesoft-labs,项目名称:connector-certification-tools,代码行数:26,代码来源:DirectoryStructureRule.java


示例5: create

import org.apache.velocity.runtime.parser.node.SimpleNode; //导入依赖的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;
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:11,代码来源:VelocityUtils.java


示例6: VelocitySqlSource

import org.apache.velocity.runtime.parser.node.SimpleNode; //导入依赖的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);
  }
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:15,代码来源:VelocitySqlSource.java


示例7: createTemplate

import org.apache.velocity.runtime.parser.node.SimpleNode; //导入依赖的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;
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:19,代码来源:MailUtil.java


示例8: create

import org.apache.velocity.runtime.parser.node.SimpleNode; //导入依赖的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;
}
 
开发者ID:thingsboard,项目名称:thingsboard,代码行数:11,代码来源:VelocityUtils.java


示例9: toText

import org.apache.velocity.runtime.parser.node.SimpleNode; //导入依赖的package包/类
/**
 * Returns the result of substituting the variables defined by the fields of this class
 * (a concrete subclass of TemplateVars) into the template returned by {@link #parsedTemplate()}.
 */
String toText() {
  VelocityContext velocityContext = toVelocityContext();
  StringWriter writer = new StringWriter();
  SimpleNode parsedTemplate = parsedTemplate();
  boolean rendered = velocityRuntimeInstance.render(
      velocityContext, writer, parsedTemplate.getTemplateName(), parsedTemplate);
  if (!rendered) {
    // I don't know when this happens. Usually you get an exception during rendering.
    throw new IllegalArgumentException("Template rendering failed");
  }
  return writer.toString();
}
 
开发者ID:yongjhih,项目名称:RetroFacebook,代码行数:17,代码来源:TemplateVars.java


示例10: parsedTemplateForResource

import org.apache.velocity.runtime.parser.node.SimpleNode; //导入依赖的package包/类
static SimpleNode parsedTemplateForResource(String templateStr, String resourceName) {
  try {
    return velocityRuntimeInstance.parse(templateStr, resourceName);
  } catch (ParseException e) {
    throw new AssertionError(e);
  }
}
 
开发者ID:yongjhih,项目名称:RetroFacebook,代码行数:8,代码来源:TemplateVars.java


示例11: parsedTemplateForString

import org.apache.velocity.runtime.parser.node.SimpleNode; //导入依赖的package包/类
static SimpleNode parsedTemplateForString(String string) {
  try {
    Reader reader = new StringReader(string);
    return RuntimeSingleton.parse(reader, string);
  } catch (ParseException e) {
    throw new AssertionError(e);
  }
}
 
开发者ID:yongjhih,项目名称:RetroFacebook,代码行数:9,代码来源:TemplateVarsTest.java


示例12: compile

import org.apache.velocity.runtime.parser.node.SimpleNode; //导入依赖的package包/类
public static Object compile(String script, String name) {
  try {
    StringReader reader = new StringReader(script);
    Template template = new Template();
    SimpleNode node = engine.parse(reader, template);
    template.setRuntimeServices(engine);
    template.setData(node);
    template.setName(name);
    template.initDocument();
    return template;
  } catch (Exception ex) {
    throw new BuilderException("Error parsing velocity script '" + name + "'", ex);
  }
}
 
开发者ID:mybatis,项目名称:velocity-scripting,代码行数:15,代码来源:VelocityFacade.java


示例13: parsedTemplate

import org.apache.velocity.runtime.parser.node.SimpleNode; //导入依赖的package包/类
@Override
SimpleNode parsedTemplate() {
  return TEMPLATE;
}
 
开发者ID:yongjhih,项目名称:RetroFacebook,代码行数:5,代码来源:RetroFacebookTemplateVars.java


示例14: parsedTemplate

import org.apache.velocity.runtime.parser.node.SimpleNode; //导入依赖的package包/类
@Override SimpleNode parsedTemplate() {
  return parsedTemplateForString("integer=$integer string=$string list=$list");
}
 
开发者ID:yongjhih,项目名称:RetroFacebook,代码行数:4,代码来源:TemplateVarsTest.java



注:本文中的org.apache.velocity.runtime.parser.node.SimpleNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OWLAnnotationAssertionAxiom类代码示例发布时间:2022-05-21
下一篇:
Java ResultLogConfig类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap