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

Java STGroupDir类代码示例

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

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



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

示例1: initSTGroup

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
private STGroupDir initSTGroup(Raml raml) {
    final STGroupDir group = loadGroupDir("guru/nidi/raml/doc/st-templates");

    group.registerModelAdaptor(Map.class, new EntrySetMapModelAdaptor());
    group.registerModelAdaptor(Raml.class, new RamlAdaptor());
    group.registerModelAdaptor(Resource.class, new ResourceAdaptor());
    group.registerModelAdaptor(Action.class, new ActionAdaptor(raml));
    group.registerModelAdaptor(SecuritySchemeDescriptor.class, new SecuritySchemeDescriptorAdaptor());
    group.registerModelAdaptor(Response.class, new ResponseAdaptor());

    group.registerRenderer(String.class, new StringRenderer(raml, config.getResourceCache()));
    group.registerRenderer(AbstractParam.class, new ParamRenderer());
    group.registerRenderer(Raml.class, new RamlRenderer());

    return group;
}
 
开发者ID:nidi3,项目名称:raml-doc,代码行数:17,代码来源:Generator.java


示例2: loadGroupDir

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
private STGroupDir loadGroupDir(String path) {
    try {
        return new STGroupDir(path, '$', '$');
    } catch (IllegalArgumentException e) {
        //websphere classloader needs a trailing / to find directories on the classpath
        //-> add it to check if it exists, and then remove it
        final STGroupDir stGroupDir = new STGroupDir(path + "/", '$', '$');
        final String url = stGroupDir.root.toExternalForm();
        try {
            stGroupDir.root = new URL(url.substring(0, url.length() - 1));
            return stGroupDir;
        } catch (MalformedURLException me) {
            throw new IllegalArgumentException(me);
        }
    }
}
 
开发者ID:nidi3,项目名称:raml-doc,代码行数:17,代码来源:Generator.java


示例3: generateGuiceModule

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
/**
 * Generate the guice module with bindings.
 *
 * @throws IOException
 */
private void generateGuiceModule() throws IOException {
    final Set<Class<?>> classes = getServiceClasses();
    new STGroupDir(getClass().getPackage().getName().replaceAll("\\.", "/"));
    final File generatedSourceDirectory = getTargetSourceDirectory();

    final Map<String, String> stubProxyMap = new HashMap<>();
    for (final Class<?> klass : classes) {
        stubProxyMap.put(getStubClassName(klass), getProxyImplemenationName(klass));
    }

    log("Generating guice module", Project.MSG_ERR);

    final GuiceModuleGenerator moduleGenerator = new GuiceModuleGenerator();
    moduleGenerator.generateGuiceModule(destinationPackage, generatedSourceDirectory,
            stubProxyMap);
}
 
开发者ID:strandls,项目名称:alchemy-rest-client-generator,代码行数:22,代码来源:RestProxyGenerator.java


示例4: generateProxyImplementations

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
/**
 * Generate the proxy implementations for the services.
 *
 * @throws IOException
 */
private void generateProxyImplementations() throws IOException {
    final Set<Class<?>> classes = getServiceClasses();
    new STGroupDir(getClass().getPackage().getName().replaceAll("\\.", "/"));
    final File generatedSourceDirectory = getTargetSourceDirectory();

    log("Generating proxies", Project.MSG_ERR);

    final ProxyImplementationGenerator proxyGenerator = new ProxyImplementationGenerator();
    for (final Class<?> klass : classes) {
        proxyGenerator.generateProxy(getStubClassName(klass), getProxyImplemenationName(klass),
                destinationPackage, generatedSourceDirectory);
        log("Generated " + getProxyImplemenationName(klass), Project.MSG_INFO);
    }

}
 
开发者ID:strandls,项目名称:alchemy-rest-client-generator,代码行数:21,代码来源:RestProxyGenerator.java


示例5: setupTemplateGroup

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
private final STGroupDir setupTemplateGroup(String templateRootFolder, StringTemplateConfiguration config) {
            
        //if in production or test
        // when reading the template from disk, do the minification at this point
        // so the STWriter does not have to handle that.
        // (This probably means something like extending STGroup and handle its caching
        // a little differently)
        boolean minimise = mode != Modes.DEV; // probably just as outputHtmlIndented
        
        STGroupDir group = new STFastGroupDir(templateRootFolder, config.delimiterStart, config.delimiterEnd, minimise);
        
        // add the user configurations
        config.adaptors.forEach(group::registerModelAdaptor);
        config.renderers.forEach(group::registerRenderer);
        
        // adding a fallback group that will try to serve from resources instead of webapp/WEB-INF/
//            STGroupDir fallbackGroup = new STRawGroupDir("views", config.delimiterStart, config.delimiterEnd);
//            group.importTemplates(fallbackGroup);
        
        return group;
    }
 
开发者ID:MTDdk,项目名称:jawn,代码行数:22,代码来源:StringTemplateTemplateEngine.java


示例6: doGenerate

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
private void doGenerate(Raml raml, List<Raml> ramls) throws IOException {
    final STGroupDir group = initSTGroup(raml);

    if (raml == ramls.get(0)) {
        config.getTarget().mkdirs();
        if (!config.isForceDelete()) {
            checkTargetEmpty(config.getTarget(), config.getResourceCache().getBasedir(), ramls);
        }
        deleteAll(config.getTarget());
        generateBase(raml, group);
    }

    final File target = getTarget(raml);
    target.mkdirs();

    final ST main = group.getInstanceOf("main/main");
    main.add("ramls", ramls);
    main.add("baseUri", config.hasFeature(Feature.TRYOUT) ? config.getBaseUri(raml) : null);
    main.add("download", config.hasFeature(Feature.DOWNLOAD));
    main.add("docson", config.hasFeature(Feature.DOCSON));

    set(main, "raml", raml);
    render(main, "/main/doc", ".", new File(target, "index.html"));

    renderResources(raml, main, target);
    renderSecurity(raml, main, target);
}
 
开发者ID:nidi3,项目名称:raml-doc,代码行数:28,代码来源:Generator.java


示例7: generateBase

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
private void generateBase(Raml raml, STGroupDir group) throws IOException {
    copyStaticResources(config.getTarget(), STATIC_FILES);
    copyCustomResources(config.getTarget(), CUSTOM_FILES);
    transformLessResources(config.getTarget());

    final ST index = group.getInstanceOf("main/index");
    index.add("firstIndex", filenameFor(raml) + "/index.html");
    render(index, new File(config.getTarget(), "index.html"));
}
 
开发者ID:nidi3,项目名称:raml-doc,代码行数:10,代码来源:Generator.java


示例8: StringTemplateTemplateEngine

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
@Inject
    public StringTemplateTemplateEngine(TemplateConfigProvider<StringTemplateConfiguration> templateConfig,
                                        JawnConfigurations properties,
                                        DeploymentInfo info,
                                        SiteConfigurationReader configReader) {
        log.warn("Starting the StringTemplateTemplateEngine");
        
        STGroupDir.verbose = false;
        Interpreter.trace = false;

        useCache = !properties.isDev();
        outputHtmlIndented = !properties.isProd();
        mode = properties.getMode();
        
        this.configReader = configReader;
        this.templateLoader = new ContentTemplateLoader<>(info, this);
        templateRootFolder = templateLoader.getTemplateRootFolder();
        
        StringTemplateConfiguration config = new StringTemplateConfiguration();
        
        // Add standard renderers
        // TODO Do some HTML escaping by standard
//        config.registerRenderer(String.class, new StringRenderer());
        
        TemplateConfig<StringTemplateConfiguration> stringTemplateConfig = templateConfig.get();
        if (stringTemplateConfig != null) {
            stringTemplateConfig.init(config);
        }
        
        group = setupTemplateGroup(templateRootFolder, config);
    }
 
开发者ID:MTDdk,项目名称:jawn,代码行数:32,代码来源:StringTemplateTemplateEngine.java


示例9: main

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
public static void main(String[] args) {
	STGroupDir templates = new STGroupDir(".");
	ST st = templates.getInstanceOf("page");

	st.add("users", new MyUser(143, "parrt"));
	st.add("users", new MyUser(3, "tombu"));
	st.add("users", new MyUser(99, "kg9s"));

	Map<String,String> phones = new HashMap<String, String>();
	phones.put("parrt", "x5707");
	phones.put("tombu", "x5302");
	st.add("phones", phones);
	System.out.println(st.render());
}
 
开发者ID:parrt,项目名称:cs601,代码行数:15,代码来源:TestUsersStringTemplate.java


示例10: main

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
public static void main(String[] args) {
	String[] names = {"Terence", "Jim", "Ketaki", "Siddharth"};
	String[] phones = {"x1", "x9", "x2", "x5"};
	User[] users = {new User("Tom", "x99"), new User("Jane","x1")};

	STGroup group = new STGroupDir(".");
	ST st = group.getInstanceOf("fill");
	st.add("names", names);
	st.add("phones", phones);
	st.add("users", users);
	System.out.println(st.toString());
}
 
开发者ID:parrt,项目名称:cs601,代码行数:13,代码来源:Fill.java


示例11: Generator

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
public Generator(String pathToGenerate){
    this.symbolTable = new HashMap<>();
    group = new STGroupDir(STpath+"common",'$', '$');
    importsgroup = new STGroupDir(STpath+"imports",'$', '$');
    amgroup = new STGroupDir(STpath+"amchart",'$', '$');
    highgroup = new STGroupDir(STpath+"highchart",'$', '$');
    smartcampusgroup = new STGroupDir(STpath+"smartcampus",'$', '$');
    this.newSymbol("pathToGenerate",pathToGenerate);
}
 
开发者ID:ace-design,项目名称:sensor-data-compo-visu,代码行数:10,代码来源:Generator.java


示例12: CodeGenerator

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
public CodeGenerator() {
  try {
    URL url = this.getClass().getResource(TEMPLATES_BASEDIR);
    File dir = new File(url.toURI());
    mGroup = new STGroupDir(dir.getAbsolutePath());
  } catch (URISyntaxException e) {
    mLogger.error("Error finding the templates", e);
  }
}
 
开发者ID:talberto,项目名称:easybeans,代码行数:10,代码来源:CodeGenerator.java


示例13: retrieveUncachedGroup

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
/**
     * Retrieves the string template group.
     * @param path the path.
     * @param lookupPaths the lookup paths.
     * @param errorListener the {@link STErrorListener} instance.
     * @param charset the charset.
     * @return such instance.
     */
    @NotNull
    protected STGroup retrieveUncachedGroup(
        @NotNull final String path,
        @NotNull final List<String> lookupPaths,
        @NotNull final STErrorListener errorListener,
        @NotNull final Charset charset)
    {
        @NotNull final STGroupFile result = new STGroupFile(path, charset.displayName());
//        STGroup.verbose = true;

//        result.importTemplates(new STGroupDir("org/acmsl/queryj/dao", charset.displayName()));
//        result.importTemplates(new STGroupDir("org/acmsl/queryj/vo", charset.displayName()));
        for (@Nullable final String lookupPath : lookupPaths)
        {
            if (lookupPath != null)
            {
                result.importTemplates(new STGroupDir(lookupPath, charset.displayName()));
            }
        }
        result.isDefined(Literals.SOURCE);
        result.setListener(errorListener);

//        STGroup.registerGroupLoader(loader);
//        STroup.registerDefaultLexer(AngleBracketTemplateLexer.class);

//        result = STGroup.loadGroup(path);

        return result;
    }
 
开发者ID:rydnr,项目名称:queryj,代码行数:38,代码来源:STUtils.java


示例14: main

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
public static void main(String[] args) {
	// all attributes are single-valued:
	ST query =
			new ST("SELECT <column> FROM <table>;");
	query.add("column", "name");
	query.add("table", "User");
	System.out.println("QUERY: "+query.render());

	// if column can be multi-valued, specify a separator
	query = new ST("SELECT <distinct> <column; separator=\", \"> FROM <table>;");
	query.add("column", "name");
	query.add("column", "email");
	query.add("table", "User");
	// uncomment next line to make "DISTINCT" appear in output
	query.add("distinct", "DISTINCT");
	System.out.println("QUERY: "+query.render());

	// specify a template to apply to an attribute
	// Use a template group so we can specify the start/stop chars
	ST list = new ST("<ul>$items$</ul>", '$', '$');
	// demonstrate setting arg to anonymous subtemplate
	// could use $item[i]$ in template, but want to show args here.
	ST item = new ST("$item:{x | <li>x</li>}$", '$', '$');
	item.add("item", "Terence");
	item.add("item", "Jim");
	item.add("item", "John");
	list.add("items", item); // nested template
	System.out.println("HTML: "+list.render());

	// Look for templates in CLASSPATH as resources
	STGroup mgroup = new STGroupDir(".");
	ST m = mgroup.getInstanceOf("method");
	// "method.st" references body() so "body.st" will be loaded too
	m.add("visibility", "public");
	m.add("name", "foobar");
       m.add("returnType", "void");
       System.out.println("Java: " +m.render());

       ST t = new ST("List:\n"+
                     "$names:{n | <br>$i$. $n$\n}$\n", '$', '$');
       t.add("names", "Terence");
       t.add("names", "Jim");
       t.add("names", "Sriram");
	System.out.println("HTML: " +t.render());
}
 
开发者ID:parrt,项目名称:cs601,代码行数:46,代码来源:Test.java


示例15: FacadeTemplates

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
private FacadeTemplates(ServletContext context) {
	String realPath = context.getRealPath("tmpl4");
	_stGroupDir = new STGroupDir(realPath, "UTF-8", '$', '$');
}
 
开发者ID:akuz,项目名称:readrz-public,代码行数:5,代码来源:FacadeTemplates.java


示例16: FeatureWidgetQueries

import org.stringtemplate.v4.STGroupDir; //导入依赖的package包/类
/**
 * Constructs the source system query configuration class, based on system
 * settings.
 *
 * @param featureSettings
 *            Feature collector system settings
 */
public FeatureWidgetQueries(FeatureSettings featureSettings) {
	this.featureSettings = featureSettings;
	this.queryFolder = this.featureSettings.getQueryFolder();
	this.folder = new STGroupDir(queryFolder, '$', '$');
}
 
开发者ID:jimzucker,项目名称:hygieia-temp,代码行数:13,代码来源:FeatureWidgetQueries.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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