当前位置: 首页>>代码示例>>Java>>正文


Java StringTemplateGroup.getInstanceOf方法代码示例

本文整理汇总了Java中org.antlr.stringtemplate.StringTemplateGroup.getInstanceOf方法的典型用法代码示例。如果您正苦于以下问题:Java StringTemplateGroup.getInstanceOf方法的具体用法?Java StringTemplateGroup.getInstanceOf怎么用?Java StringTemplateGroup.getInstanceOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.antlr.stringtemplate.StringTemplateGroup的用法示例。


在下文中一共展示了StringTemplateGroup.getInstanceOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createIndexTemplate

import org.antlr.stringtemplate.StringTemplateGroup; //导入方法依赖的package包/类
public static StringTemplate createIndexTemplate(String typeName, String sdkName, String packageName, List<IndexedAnnotation> indices,
        Map<String, String> fieldNameToType, StringTemplateGroup templateLib) {
    AbstractTTree.STAttrMap attrMap = new AbstractTTree.STAttrMap().put("name", typeName).put("sdkName", sdkName).put("package", packageName);

    List<StringTemplate> functionCalls = new LinkedList<StringTemplate>();
    List<StringTemplate> functionDefinitions = new LinkedList<StringTemplate>();
    for (IndexedAnnotation indexedAnnotation : indices) {
        StringTemplate createIndexDefinition = createIndexDefinitionTemplate(templateLib, packageName, typeName, indexedAnnotation, fieldNameToType);
        functionDefinitions.add(createIndexDefinition);

        StringTemplate indexCall = createIndexCallTemplate(templateLib, indexedAnnotation);
        functionCalls.add(indexCall);
    }

    if (indices.size() > 0) {
        attrMap.put("functionDefinitions", functionDefinitions);
        attrMap.put("functionCalls", functionCalls);
    }

    return templateLib.getInstanceOf("beanIndexInfoClass", attrMap);
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:22,代码来源:IndexTemplateFactory.java

示例2: getHtml

import org.antlr.stringtemplate.StringTemplateGroup; //导入方法依赖的package包/类
private String getHtml()
{
	final StringTemplateGroup templates = new StringTemplateGroup( "manager" );
	final StringTemplate t = templates.getInstanceOf( "templates/manager" );

	t.setAttribute( "bytesSent", getByteSizeString( statHandler.getResponsesBytesTotal() ) );
	t.setAttribute( "msgPerSec", connectorStats.getMessagesOutPerSecond() );
	t.setAttribute( "openConnections", connectorStats.getConnectionsOpen() );
	t.setAttribute( "maxOpenConnections", connectorStats.getConnectionsOpenMax() );

	getContexts();

	t.setAttribute( "contexts", contexts );

	t.setAttribute( "noDataSets", noDataSets );
	t.setAttribute( "sizeDataSets", getByteSizeString( sizeDataSets ) );

	t.setAttribute( "statHtml", statHandler.toStatsHTML() );

	return t.toString();
}
 
开发者ID:bigdataviewer,项目名称:bigdataviewer-server,代码行数:22,代码来源:ManagerHandler.java

示例3: createPackageIndexPage

import org.antlr.stringtemplate.StringTemplateGroup; //导入方法依赖的package包/类
private void createPackageIndexPage(final PackageSummaryData psData) {
  final StringTemplateGroup group = new StringTemplateGroup("mutation_test");
  final StringTemplate st = group
      .getInstanceOf("templates/mutation/package_index");

  final Writer writer = this.outputStrategy.createWriterForFile(psData
      .getPackageDirectory() + File.separator + "index.html");
  st.setAttribute("packageData", psData);
  try {
    writer.write(st.toString());
    writer.close();
  } catch (final IOException e) {
    e.printStackTrace();
  }

}
 
开发者ID:hcoles,项目名称:pitest,代码行数:17,代码来源:MutationHtmlReportListener.java

示例4: genExpr

import org.antlr.stringtemplate.StringTemplateGroup; //导入方法依赖的package包/类
public StringTemplate genExpr(CodeGenerator generator,
							  StringTemplateGroup templates,
							  DFA dfa)
{
	StringTemplate eST = null;
	if ( templates!=null ) {
		eST = templates.getInstanceOf("orPredicates");
	}
	else {
		eST = new StringTemplate("($first(operands)$$rest(operands):{o | ||$o$}$)");
	}
	for (Iterator it = operands.iterator(); it.hasNext();) {
		SemanticContext semctx = (SemanticContext) it.next();
		eST.setAttribute("operands", semctx.genExpr(generator,templates,dfa));
	}
	return eST;
}
 
开发者ID:pcingola,项目名称:jFuzzyLogic,代码行数:18,代码来源:SemanticContext.java

示例5: compile

import org.antlr.stringtemplate.StringTemplateGroup; //导入方法依赖的package包/类
@Override
protected void compile(ProtoModule module, Proto proto) throws IOException
{
    String javaPackageName = proto.getJavaPackageName();
    StringTemplateGroup group = getSTG(getOutputId());

    String fileName = resolveFileName(proto);
    Writer writer = CompilerUtil.newWriter(module, javaPackageName,
            "Schema" + fileName + ".java");

    AutoIndentWriter out = new AutoIndentWriter(writer);
    StringTemplate protoOuterBlock = group.getInstanceOf("proto_block");

    protoOuterBlock.setAttribute("proto", proto);
    protoOuterBlock.setAttribute("module", module);
    protoOuterBlock.setAttribute("options", module.getOptions());

    protoOuterBlock.write(out);
    writer.close();
}
 
开发者ID:protostuff,项目名称:protostuff,代码行数:21,代码来源:ProtoToJavaV2ProtocSchemaCompiler.java

示例6: writeMessages

import org.antlr.stringtemplate.StringTemplateGroup; //导入方法依赖的package包/类
protected void writeMessages(ProtoModule module, Proto proto, String javaPackageName, StringTemplateGroup group)
        throws IOException
{
    for (Message m : proto.getMessages())
    {
        Writer writer = CompilerUtil.newWriter(module,
                javaPackageName, m.getName() + ".java");
        AutoIndentWriter out = new AutoIndentWriter(writer);

        StringTemplate messageBlock = group.getInstanceOf("message_block");
        messageBlock.setAttribute("message", m);
        messageBlock.setAttribute("module", module);
        messageBlock.setAttribute("options", module.getOptions());

        messageBlock.write(out);
        writer.close();
    }
}
 
开发者ID:protostuff,项目名称:protostuff,代码行数:19,代码来源:ProtoToJavaBeanCompiler.java

示例7: writeEnums

import org.antlr.stringtemplate.StringTemplateGroup; //导入方法依赖的package包/类
protected void writeEnums(ProtoModule module, Proto proto, String javaPackageName, StringTemplateGroup group)
        throws IOException
{
    for (EnumGroup eg : proto.getEnumGroups())
    {
        Writer writer = CompilerUtil.newWriter(module,
                javaPackageName, eg.getName() + ".java");
        AutoIndentWriter out = new AutoIndentWriter(writer);

        StringTemplate enumBlock = group.getInstanceOf("enum_block");
        enumBlock.setAttribute("eg", eg);
        enumBlock.setAttribute("module", module);
        enumBlock.setAttribute("options", module.getOptions());

        enumBlock.write(out);
        writer.close();
    }
}
 
开发者ID:protostuff,项目名称:protostuff,代码行数:19,代码来源:ProtoToJavaBeanCompiler.java

示例8: createIndexDefinitionTemplate

import org.antlr.stringtemplate.StringTemplateGroup; //导入方法依赖的package包/类
private static StringTemplate createIndexDefinitionTemplate(StringTemplateGroup templateLib, String packageName, String className,
        IndexedAnnotation indexedAnnotation,
        Map<String, String> fieldNameToType) {
    List<StringTemplate> fields = createIndexFieldsTemplates(templateLib, packageName, className, indexedAnnotation, fieldNameToType);
    Map<?, ?> definitionMap = new AbstractTTree.STAttrMap().put("name", indexedAnnotation.getName()).put("fields", fields);
    return templateLib.getInstanceOf("createIndexDefinition", definitionMap);
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:8,代码来源:IndexTemplateFactory.java

示例9: run

import org.antlr.stringtemplate.StringTemplateGroup; //导入方法依赖的package包/类
/**
 * Runs the code generation for all templates.
 */
public void run() throws PstException {
  List<PstException.TemplateException> exceptions = Lists.newArrayList();
  for (File template : templates) {
    try {
      MessageProperties properties = createProperties(template);
      String groupName = stripSuffix(".st", template.getName());
      String templateName = properties.hasTemplateName() ?
          properties.getTemplateName() : "";
      StringTemplateGroup group = new StringTemplateGroup(groupName + "Group", dir(template));
      StringTemplate st = group.getInstanceOf(groupName);
      for (Descriptor messageDescriptor : fd.getMessageTypes()) {
        Message message = new Message(messageDescriptor, templateName, properties);
        st.reset();
        st.setAttribute("m", message);
        write(st, new File(
            outputDir.getPath() + File.separator +
            message.getFullJavaType().replace('.', File.separatorChar) + "." +
            (properties.hasFileExtension() ? properties.getFileExtension() : "java")));
      }
    } catch (Exception e) {
      exceptions.add(new PstException.TemplateException(template.getPath(), e));
    }
  }
  if (!exceptions.isEmpty()) {
    throw new PstException(exceptions);
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:31,代码来源:Pst.java

示例10: genExpr

import org.antlr.stringtemplate.StringTemplateGroup; //导入方法依赖的package包/类
public StringTemplate genExpr(CodeGenerator generator,
							  StringTemplateGroup templates,
							  DFA dfa)
{
	if ( templates!=null ) {
		return templates.getInstanceOf("true");
	}
	return new StringTemplate("true");
}
 
开发者ID:Sable,项目名称:mclab-core,代码行数:10,代码来源:SemanticContext.java

示例11: createIndexPages

import org.antlr.stringtemplate.StringTemplateGroup; //导入方法依赖的package包/类
private void createIndexPages() {

    final StringTemplateGroup group = new StringTemplateGroup("mutation_test");
    final StringTemplate st = group
        .getInstanceOf("templates/mutation/mutation_package_index");

    final Writer writer = this.outputStrategy.createWriterForFile("index.html");
    final MutationTotals totals = new MutationTotals();

    final List<PackageSummaryData> psd = new ArrayList<>(
        this.packageSummaryData.values());
    Collections.sort(psd);
    for (final PackageSummaryData psData : psd) {
      totals.add(psData.getTotals());
      createPackageIndexPage(psData);
    }

    st.setAttribute("totals", totals);
    st.setAttribute("packageSummaries", psd);
    try {
      writer.write(st.toString());
      writer.close();
    } catch (final IOException e) {
      e.printStackTrace();
    }

  }
 
开发者ID:hcoles,项目名称:pitest,代码行数:28,代码来源:MutationHtmlReportListener.java

示例12: genClassHeader

import org.antlr.stringtemplate.StringTemplateGroup; //导入方法依赖的package包/类
protected String genClassHeader(StringTemplateGroup group, String junitFileName) {
	StringTemplate classHeaderST = group.getInstanceOf("classHeader");
	if ( grammarInfo.getHeader()!=null ) {	// Set up class package if there is
		classHeaderST.setAttribute("header", "package "+grammarInfo.getHeader()+";");
	}
	classHeaderST.setAttribute("junitFileName", junitFileName);
	return classHeaderST.toString();
}
 
开发者ID:pcingola,项目名称:jFuzzyLogic,代码行数:9,代码来源:JUnitCodeGen.java

示例13: genSupportingMethods

import org.antlr.stringtemplate.StringTemplateGroup; //导入方法依赖的package包/类
protected String genSupportingMethods(StringTemplateGroup group, String lexerName, String parserName) {
	StringTemplate supportingMethodST;
	String parserPath;
	String treeParserPath;
	/** Set up appropriate class path for parser/tree parser if using package */
	if ( grammarInfo.getHeader()!=null ) {
		parserPath = grammarInfo.getHeader()+"."+parserName;
		treeParserPath = grammarInfo.getHeader()+"."+grammarInfo.getTreeGrammarName();
	}
	else {
		parserPath = parserName;
		treeParserPath = grammarInfo.getTreeGrammarName();
	}
	/** Set up different parser executer for parser grammar and tree grammar */
	if ( grammarInfo.getTreeGrammarName()!=null ) {	// Load template for testing tree grammar
		supportingMethodST = group.getInstanceOf("execTreeParser");
		supportingMethodST.setAttribute("treeParserName", grammarInfo.getTreeGrammarName());
		supportingMethodST.setAttribute("treeParserPath", treeParserPath);
	}
	else {	// Load template for testing grammar
		supportingMethodST = group.getInstanceOf("execParser");
	}
	supportingMethodST.setAttribute("lexerName", lexerName);
	supportingMethodST.setAttribute("parserName", parserName);
	supportingMethodST.setAttribute("parserPath", parserPath);
	return supportingMethodST.toString();
}
 
开发者ID:pcingola,项目名称:jFuzzyLogic,代码行数:28,代码来源:JUnitCodeGen.java

示例14: writeConfigurations

import org.antlr.stringtemplate.StringTemplateGroup; //导入方法依赖的package包/类
public void writeConfigurations ( ) throws FileNotFoundException , IOException {
	StringTemplateGroup templateGroup = new StringTemplateGroup( "ch.epfl.gsn" );
	StringTemplate st = templateGroup.getInstanceOf( "ch.epfl.gsn/gui/templates/templateConf" );
	st.setAttribute( "db_user" , storage.getJdbcUsername( ) );
	st.setAttribute( "db_password" , storage.getJdbcPassword( ) );
	st.setAttribute( "db_driver" , storage.getJdbcDriver( ) );
	st.setAttribute( "db_url" , storage.getJdbcURL( ) );

	FileWriter writer = new FileWriter( gsnConfigurationFileName );
	writer.write( st.toString( ) );
	writer.close( );

}
 
开发者ID:LSIR,项目名称:gsn,代码行数:14,代码来源:ContainerConfig.java

示例15: TedsToVirtualSensor

import org.antlr.stringtemplate.StringTemplateGroup; //导入方法依赖的package包/类
public TedsToVirtualSensor ( String templateDir , String templateFile ) {
   this.templateDir = templateDir;
   this.templatefile = templateFile;
   StringTemplateGroup grp = new StringTemplateGroup( "myGroup" , templateDir );
   vstmp = grp.getInstanceOf( templateFile );
   
}
 
开发者ID:LSIR,项目名称:gsn,代码行数:8,代码来源:TedsToVirtualSensor.java


注:本文中的org.antlr.stringtemplate.StringTemplateGroup.getInstanceOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。