本文整理汇总了Java中com.github.jknack.handlebars.helper.StringHelpers类的典型用法代码示例。如果您正苦于以下问题:Java StringHelpers类的具体用法?Java StringHelpers怎么用?Java StringHelpers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringHelpers类属于com.github.jknack.handlebars.helper包,在下文中一共展示了StringHelpers类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: apply
import com.github.jknack.handlebars.helper.StringHelpers; //导入依赖的package包/类
Context apply(String s, Map<String, String> args, boolean isBatch, Handle dbiHandle, Map<String, String> parameters, NameList names) throws IOException {
ObjectReader mapper = new ObjectMapper().readerFor(Object.class);
HashMap<String, Object> parsedArgs = new HashMap<>();
for (Map.Entry<String, String> a : args.entrySet()) {
try {
parsedArgs.put(a.getKey(), mapper.readValue(a.getValue()));
} catch (Exception e) {
parsedArgs.put(a.getKey(), a.getValue());
}
}
Handlebars handlebars = new Handlebars().with(EscapingStrategy.NOOP);
this.parameters = parameters;
StringHelper.register(handlebars);
StringHelpers.register(handlebars);
FilterHelper.register(handlebars);
ConditionalHelper.register(handlebars);
new ParameterHelper(parameters, names).registerHelper(handlebars);
eh = new EachHelper(parameters, names, isBatch, dbiHandle).registerHelper(handlebars);
template = handlebars.compileInline(s);
sql = template.apply(parsedArgs);
return this;
}
开发者ID:CeeqlGroup,项目名称:ceeql,代码行数:27,代码来源:CeeqlTemplate.java
示例2: apply
import com.github.jknack.handlebars.helper.StringHelpers; //导入依赖的package包/类
protected String apply(String s, Object context) throws IOException {
Handlebars handlebars = new Handlebars().with(EscapingStrategy.NOOP);
StringHelper.register(handlebars);
StringHelpers.register(handlebars);
FilterHelper.register(handlebars);
ConditionalHelper.register(handlebars);
parameters = new LinkedHashMap<String, String>();
names = new NameList() {
int i = 0;
protected String next() {
return "p"+(i++);
}
};
new ParameterHelper(parameters, names).registerHelper(handlebars);
return handlebars.compileInline(s).apply(
(context!=null && context instanceof TestUtils.MapBuilder)?
((TestUtils.MapBuilder)context).build() : context);
}
开发者ID:CeeqlGroup,项目名称:ceeql,代码行数:19,代码来源:AbstractHelperTest.java
示例3: TemplateEngine
import com.github.jknack.handlebars.helper.StringHelpers; //导入依赖的package包/类
public TemplateEngine(String template) {
handlebars = new Handlebars(new ClassPathTemplateLoader("/", ""));
handlebars.registerHelper("json", Jackson2Helper.INSTANCE);
handlebars.registerHelper("join", StringHelpers.join);
handlebars.registerHelper("ifequal", IfEqualHelper.INSTANCE);
handlebars.prettyPrint(true);
location = "templates/" + template;
}
开发者ID:bonitasoft,项目名称:bonita-ui-designer,代码行数:10,代码来源:TemplateEngine.java
示例4: Xsd2JaxbGenerator
import com.github.jknack.handlebars.helper.StringHelpers; //导入依赖的package包/类
public Xsd2JaxbGenerator() {
Handlebars handlebars = new Handlebars();
handlebars.registerHelper("capFirst", StringHelpers.capitalize);
handlebars.registerHelper("each",
new com.legstar.jaxb.generator.EachHelper());
hbtJaxbWrapperFactoryClass = loadTemplate(handlebars,
JAXB_WRAPPER_FACTORY_CLASS_TEMPLATE_NAME);
hbtJaxbConverterClass = loadTemplate(handlebars,
JAXB_CONVERTER_CLASS_TEMPLATE_NAME);
modelBuilder = new Xsd2CobolTypesModelBuilder();
}
开发者ID:legsem,项目名称:legstar-core2,代码行数:12,代码来源:Xsd2JaxbGenerator.java
示例5: initTemplate
import com.github.jknack.handlebars.helper.StringHelpers; //导入依赖的package包/类
private static Template initTemplate(String templateName) throws IOException {
Handlebars handlebars = new Handlebars(new ClassPathTemplateLoader(sf_templatePrefix));
StringHelpers.register(handlebars);
handlebars.registerHelpers(ReportHelpers.class);
return handlebars.compile(templateName);
}
开发者ID:PharmGKB,项目名称:PharmCAT,代码行数:7,代码来源:HtmlReportGenerator.java
示例6: setupHandlerbars
import com.github.jknack.handlebars.helper.StringHelpers; //导入依赖的package包/类
private void setupHandlerbars() {
handlebars.registerHelper(StringHelpers.lower.name(), StringHelpers.lower);
handlebars.registerHelper("header", new HeaderHelper());
handlebars.prettyPrint(true);
}
开发者ID:mvb-online,项目名称:restapi-doc,代码行数:6,代码来源:RestApiDocGeneratorMojo.java
注:本文中的com.github.jknack.handlebars.helper.StringHelpers类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论