org.apache.velocity.runtime.RuntimeSingleton.parse()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中org.apache.velocity.runtime.RuntimeSingleton.parse方法的一些代码示例,展示了RuntimeSingleton.parse的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RuntimeSingleton.parse方法的具体详情如下:
包路径:org.apache.velocity.runtime.RuntimeSingleton
类名称:RuntimeSingleton
方法名:parse

RuntimeSingleton.parse介绍

[英]Parse the input and return the root of AST node structure.

In the event that it runs out of parsers in the pool, it will create and let them be GC'd dynamically, logging that it has to do that. This is considered an exceptional condition. It is expected that the user will set the PARSER_POOL_SIZE property appropriately for their application. We will revisit this.
[中]解析输入并返回AST节点结构的根。
如果池中的解析器用完了,它将创建并动态地对它们进行GC,并记录它必须这样做。这被认为是一种例外情况。预计用户将为其应用程序适当地设置PARSER_POOL_SIZE属性。我们将再次讨论这个问题。

代码示例

代码示例来源:origin: velocity/velocity-dep

/**
 *  Parse the input and return the root of the AST node structure.
 *
 * @param InputStream inputstream retrieved by a resource loader
 * @param String name of the template being parsed
 * @param dumpNamespace flag to dump the Velocimacro namespace for this template
 */
public static SimpleNode parse( Reader reader, String templateName, boolean dumpNamespace )
  throws ParseException
{
  return RuntimeSingleton.parse( reader, templateName, dumpNamespace );
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.velocity

/**
 * Parse the input and return the root of the AST node structure.
 *
 * @see #parse(Reader, String)
 *
 * @param reader A reader returning the template input stream.
 * @param templateName name of the template being parsed
 * @param dumpNamespace flag to dump the Velocimacro namespace for this template.
 * @return The root node of an AST structure for the template input stream.
 * @throws ParseException When the input stream is not parsable.
 */
public static SimpleNode parse( Reader reader, String templateName, boolean dumpNamespace )
  throws ParseException
{
  return RuntimeSingleton.parse( reader, templateName, dumpNamespace );
}

代码示例来源:origin: org.apache.velocity/com.springsource.org.apache.velocity

/**
 * Parse the input and return the root of the AST node structure.
 *
 * @see #parse(Reader, String)
 *
 * @param reader A reader returning the template input stream.
 * @param templateName name of the template being parsed
 * @param dumpNamespace flag to dump the Velocimacro namespace for this template.
 * @return The root node of an AST structure for the template input stream.
 * @throws ParseException When the input stream is not parsable.
 */
public static SimpleNode parse( Reader reader, String templateName, boolean dumpNamespace )
  throws ParseException
{
  return RuntimeSingleton.parse( reader, templateName, dumpNamespace );
}

代码示例来源:origin: velocity/velocity-dep

/**
 * Parse the input and return the root of
 * AST node structure.
 * <br><br>
 *  In the event that it runs out of parsers in the
 *  pool, it will create and let them be GC'd 
 *  dynamically, logging that it has to do that.  This
 *  is considered an exceptional condition.  It is
 *  expected that the user will set the 
 *  PARSER_POOL_SIZE property appropriately for their
 *  application.  We will revisit this.
 *
 * @param InputStream inputstream retrieved by a resource loader
 * @param String name of the template being parsed
 */
public static SimpleNode parse( Reader reader, String templateName )
  throws ParseException
{
  return RuntimeSingleton.parse( reader, templateName );
}

代码示例来源:origin: org.apache.velocity/com.springsource.org.apache.velocity

/**
 * Parse the input and return the root of
 * AST node structure.
 * <br><br>
 *  In the event that it runs out of parsers in the
 *  pool, it will create and let them be GC'd
 *  dynamically, logging that it has to do that.  This
 *  is considered an exceptional condition.  It is
 *  expected that the user will set the
 *  PARSER_POOL_SIZE property appropriately for their
 *  application.  We will revisit this.
 *
 * @param reader A reader returning the template input stream.
 * @param templateName name of the template being parsed
 * @return The root node of an AST structure for the template input stream.
 * @throws ParseException When the input stream is not parsable.
 */
public static SimpleNode parse( Reader reader, String templateName )
  throws ParseException
{
  return RuntimeSingleton.parse( reader, templateName );
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.velocity

/**
 * Parse the input and return the root of
 * AST node structure.
 * <br><br>
 *  In the event that it runs out of parsers in the
 *  pool, it will create and let them be GC'd
 *  dynamically, logging that it has to do that.  This
 *  is considered an exceptional condition.  It is
 *  expected that the user will set the
 *  PARSER_POOL_SIZE property appropriately for their
 *  application.  We will revisit this.
 *
 * @param reader A reader returning the template input stream.
 * @param templateName name of the template being parsed
 * @return The root node of an AST structure for the template input stream.
 * @throws ParseException When the input stream is not parsable.
 */
public static SimpleNode parse( Reader reader, String templateName )
  throws ParseException
{
  return RuntimeSingleton.parse( reader, templateName );
}

代码示例来源:origin: yongjhih/RetroFacebook

static SimpleNode parsedTemplateForString(String string) {
 try {
  Reader reader = new StringReader(string);
  return RuntimeSingleton.parse(reader, string);
 } catch (ParseException e) {
  throw new AssertionError(e);
 }
}

代码示例来源:origin: yongjhih/RetroFacebook

static SimpleNode parsedTemplateForString(String string) {
 try {
  Reader reader = new StringReader(string);
  return RuntimeSingleton.parse(reader, string);
 } catch (ParseException e) {
  throw new AssertionError(e);
 }
}

代码示例来源:origin: 8tory/SimpleWeibo

static SimpleNode parsedTemplateForString(String string) {
 try {
  Reader reader = new StringReader(string);
  return RuntimeSingleton.parse(reader, string);
 } catch (ParseException e) {
  throw new AssertionError(e);
 }
}

代码示例来源:origin: yongjhih/AutoJson

static SimpleNode parsedTemplateForString(String string) {
 try {
  Reader reader = new StringReader(string);
  return RuntimeSingleton.parse(reader, string);
 } catch (ParseException e) {
  throw new AssertionError(e);
 }
}

代码示例来源:origin: velocity/velocity-dep

/**
 * Default constructor: sets up the Velocity
 * Runtime, creates the visitor for traversing
 * the node structure and then produces the
 * visual representation by the visitation.
 */
public TemplateNodeView(String template)
{
  try
  {
    RuntimeSingleton.init("velocity.properties");
    InputStreamReader isr = new InputStreamReader(
                  new FileInputStream(template),
                  RuntimeSingleton.getString(RuntimeSingleton.INPUT_ENCODING));
    BufferedReader br = new BufferedReader( isr );
                       document = RuntimeSingleton.parse( br, template);
    visitor = new NodeViewMode();
    visitor.setContext(null);
    visitor.setWriter(new PrintWriter(System.out));
    document.jjtAccept(visitor, null);
  }
  catch (Exception e)
  {
    System.out.println(e);
    e.printStackTrace();
  }
}

代码示例来源:origin: fr.opensagres/fr.opensagres.xdocreport.template.velocity

public void extractFields(Reader reader, String entryName,
      FieldsExtractor extractor) throws XDocReportException {
    try {
      SimpleNode document = RuntimeSingleton.parse(reader, entryName);
      ExtractVariablesVelocityVisitor visitor = new ExtractVariablesVelocityVisitor(
          extractor);
      visitor.setContext(null);
      // visitor.setWriter(new PrintWriter(System.out));
      document.jjtAccept(visitor, null);

    } catch (ParseException e) {
      throw new XDocReportException(e);
    }
  }
}

代码示例来源:origin: velocity/velocity-dep

nodeTree = RuntimeSingleton.parse( reader, logTag );

相关文章