本文整理汇总了Java中org.stringtemplate.v4.STGroupDir.getInstanceOf方法的典型用法代码示例。如果您正苦于以下问题:Java STGroupDir.getInstanceOf方法的具体用法?Java STGroupDir.getInstanceOf怎么用?Java STGroupDir.getInstanceOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.stringtemplate.v4.STGroupDir
的用法示例。
在下文中一共展示了STGroupDir.getInstanceOf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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"));
}
示例3: 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());
}