org.stringtemplate.v4.STGroup.defineTemplate()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(91)

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

STGroup.defineTemplate介绍

[英]for testing
[中]

代码示例

代码示例来源:origin: org.antlr/stringtemplate

public CompiledST defineTemplate(String templateName, String template) {
  try {
    CompiledST impl =
      defineTemplate(templateName,
              new CommonToken(GroupParser.ID, templateName),
              null, template, null);
    return impl;
  }
  catch (STException se) {
    // we have reported the error; the exception just blasts us
    // out of parsing this template
  }
  return null;
}

代码示例来源:origin: antlr/stringtemplate4

/** for testing */
public CompiledST defineTemplate(String name, String argsS, String template) {
  if ( name.charAt(0)!='/' ) name = "/"+name;
  String[] args = argsS.split(",");
  List<FormalArgument> a = new ArrayList<FormalArgument>();
  for (String arg : args) {
    a.add(new FormalArgument(arg));
  }
  return defineTemplate(name, new CommonToken(GroupParser.ID, name),
             a, template, null);
}

代码示例来源:origin: jsevellec/cassandra-unit

/** for testing */
public CompiledST defineTemplate(String name, String argsS, String template) {
  if ( name.charAt(0)!='/' ) name = "/"+name;
  String[] args = argsS.split(",");
  List<FormalArgument> a = new ArrayList<FormalArgument>();
  for (String arg : args) {
    a.add(new FormalArgument(arg));
  }
  return defineTemplate(name, new CommonToken(GroupParser.ID, name),
             a, template, null);
}

代码示例来源:origin: antlr/antlr3

/** for testing */
public CompiledST defineTemplate(String name, String argsS, String template) {
  if ( name.charAt(0)!='/' ) name = "/"+name;
  String[] args = argsS.split(",");
  List<FormalArgument> a = new ArrayList<FormalArgument>();
  for (String arg : args) {
    a.add(new FormalArgument(arg));
  }
  return defineTemplate(name, new CommonToken(GroupParser.ID, name),
             a, template, null);
}

代码示例来源:origin: org.antlr/ST4

/** for testing */
public CompiledST defineTemplate(String templateName, String template) {
  if ( templateName.charAt(0)!='/' ) templateName = "/"+templateName;
  try {
    CompiledST impl =
      defineTemplate(templateName,
              new CommonToken(GroupParser.ID, templateName),
              null, template, null);
    return impl;
  }
  catch (STException se) {
    // we have reported the error; the exception just blasts us
    // out of parsing this template
  }
  return null;
}

代码示例来源:origin: jsevellec/cassandra-unit

/** for testing */
public CompiledST defineTemplate(String templateName, String template) {
  if ( templateName.charAt(0)!='/' ) templateName = "/"+templateName;
  try {
    CompiledST impl =
      defineTemplate(templateName,
              new CommonToken(GroupParser.ID, templateName),
              null, template, null);
    return impl;
  }
  catch (STException se) {
    // we have reported the error; the exception just blasts us
    // out of parsing this template
  }
  return null;
}

代码示例来源:origin: org.antlr/ST4

/** for testing */
public CompiledST defineTemplate(String name, String argsS, String template) {
  if ( name.charAt(0)!='/' ) name = "/"+name;
  String[] args = argsS.split(",");
  List<FormalArgument> a = new ArrayList<FormalArgument>();
  for (String arg : args) {
    a.add(new FormalArgument(arg));
  }
  return defineTemplate(name, new CommonToken(GroupParser.ID, name),
             a, template, null);
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/** for testing */
public CompiledST defineTemplate(String templateName, String template) {
  if ( templateName.charAt(0)!='/' ) templateName = "/"+templateName;
  try {
    CompiledST impl =
      defineTemplate(templateName,
              new CommonToken(GroupParser.ID, templateName),
              null, template, null);
    return impl;
  }
  catch (STException se) {
    // we have reported the error; the exception just blasts us
    // out of parsing this template
  }
  return null;
}

代码示例来源:origin: antlr/stringtemplate4

/** for testing */
public CompiledST defineTemplate(String templateName, String template) {
  if ( templateName.charAt(0)!='/' ) templateName = "/"+templateName;
  try {
    CompiledST impl =
      defineTemplate(templateName,
              new CommonToken(GroupParser.ID, templateName),
              null, template, null);
    return impl;
  }
  catch (STException se) {
    // we have reported the error; the exception just blasts us
    // out of parsing this template
  }
  return null;
}

代码示例来源:origin: antlr/antlr3

/** for testing */
public CompiledST defineTemplate(String templateName, String template) {
  if ( templateName.charAt(0)!='/' ) templateName = "/"+templateName;
  try {
    CompiledST impl =
      defineTemplate(templateName,
              new CommonToken(GroupParser.ID, templateName),
              null, template, null);
    return impl;
  }
  catch (STException se) {
    // we have reported the error; the exception just blasts us
    // out of parsing this template
  }
  return null;
}

代码示例来源:origin: apache/servicemix-bundles

/** for testing */
public CompiledST defineTemplate(String templateName, String template) {
  if ( templateName.charAt(0)!='/' ) templateName = "/"+templateName;
  try {
    CompiledST impl =
      defineTemplate(templateName,
              new CommonToken(GroupParser.ID, templateName),
              null, template, null);
    return impl;
  }
  catch (STException se) {
    // we have reported the error; the exception just blasts us
    // out of parsing this template
  }
  return null;
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/** for testing */
public CompiledST defineTemplate(String name, String argsS, String template) {
  if ( name.charAt(0)!='/' ) name = "/"+name;
  String[] args = argsS.split(",");
  List<FormalArgument> a = new ArrayList<FormalArgument>();
  for (String arg : args) {
    a.add(new FormalArgument(arg));
  }
  return defineTemplate(name, new CommonToken(GroupParser.ID, name),
             a, template, null);
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/** for testing */
public CompiledST defineTemplate(String templateName, String template) {
  if ( templateName.charAt(0)!='/' ) templateName = "/"+templateName;
  try {
    CompiledST impl =
      defineTemplate(templateName,
              new CommonToken(GroupParser.ID, templateName),
              null, template, null);
    return impl;
  }
  catch (STException se) {
    // we have reported the error; the exception just blasts us
    // out of parsing this template
  }
  return null;
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/** for testing */
public CompiledST defineTemplate(String name, String argsS, String template) {
  if ( name.charAt(0)!='/' ) name = "/"+name;
  String[] args = argsS.split(",");
  List<FormalArgument> a = new ArrayList<FormalArgument>();
  for (String arg : args) {
    a.add(new FormalArgument(arg));
  }
  return defineTemplate(name, new CommonToken(GroupParser.ID, name),
             a, template, null);
}

代码示例来源:origin: org.antlr/stringtemplate

public CompiledST defineTemplate(String name, String argsS, String template) {
  String[] args = argsS.split(",");
  List<FormalArgument> a = new ArrayList<FormalArgument>();
  for (String arg : args) {
    a.add(new FormalArgument(arg));
  }
  return defineTemplate(name, new CommonToken(GroupParser.ID, name),
             a, template, null);
}

代码示例来源:origin: apache/servicemix-bundles

/** for testing */
public CompiledST defineTemplate(String name, String argsS, String template) {
  if ( name.charAt(0)!='/' ) name = "/"+name;
  String[] args = argsS.split(",");
  List<FormalArgument> a = new ArrayList<FormalArgument>();
  for (String arg : args) {
    a.add(new FormalArgument(arg));
  }
  return defineTemplate(name, new CommonToken(GroupParser.ID, name),
             a, template, null);
}

代码示例来源:origin: antlr/stringtemplate4

public void defineTemplateOrRegion(
  String fullyQualifiedTemplateName,
  String regionSurroundingTemplateName,
  Token templateToken,
  String template,
  Token nameToken,
  List<FormalArgument> args)
{
  try {
    if ( regionSurroundingTemplateName!=null ) {
      defineRegion(regionSurroundingTemplateName, nameToken, template, templateToken);
    }
    else {
      defineTemplate(fullyQualifiedTemplateName, nameToken, args, template, templateToken);
    }
  }
  catch (STException e) {
    // after getting syntax error in a template, we emit msg
    // and throw exception to blast all the way out to here.
  }
}

代码示例来源:origin: org.antlr/ST4

public void defineTemplateOrRegion(
  String fullyQualifiedTemplateName,
  String regionSurroundingTemplateName,
  Token templateToken,
  String template,
  Token nameToken,
  List<FormalArgument> args)
{
  try {
    if ( regionSurroundingTemplateName!=null ) {
      defineRegion(regionSurroundingTemplateName, nameToken, template, templateToken);
    }
    else {
      defineTemplate(fullyQualifiedTemplateName, nameToken, args, template, templateToken);
    }
  }
  catch (STException e) {
    // after getting syntax error in a template, we emit msg
    // and throw exception to blast all the way out to here.
  }
}

代码示例来源:origin: stackoverflow.com

STGroup grp = new STGroup('$', '$');
 final CompiledST templateA = grp.defineTemplate("a", "<li>$it.fname$ $it.lname$</li>");
 templateA.addArg(new FormalArgument("it"));
 final CompiledST templateB = grp.defineTemplate("b", "<ul>$list:a()$</ul>");
 templateB.addArg(new FormalArgument("list"));

代码示例来源:origin: stackoverflow.com

STGroup group = new STGroup('$', '$');
group.registerRenderer(...);
CompiledST compiledTemplate = group.defineTemplate("name", ...);
compiledTemplate.hasFormalArgs = false; // very important!

// later on...
ST template = group.getInstanceOf("name");

相关文章

微信公众号

最新文章

更多