本文整理了Java中org.boon.Boon.handlebars()
方法的一些代码示例,展示了Boon.handlebars()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Boon.handlebars()
方法的具体详情如下:
包路径:org.boon.Boon
类名称:Boon
方法名:handlebars
[英]Creates Handlebars style template results from string template and context
[中]根据字符串模板和上下文创建把手样式模板结果
代码示例来源:origin: boonproject/boon
/**
* Load a resource and apply the given template against it.
* If file resource is not found, tries to load the resource from classpath.
*
* @param path path to resource
* @param context context that the template uses
* @return the resource as a string
*/
public static String resourceFromHandleBarsTemplate(Path path, Object context) {
String str = IO.read(path);
if (str != null) {
str = Boon.handlebars(str, context);
}
return str;
}
代码示例来源:origin: boonproject/boon
/**
* Load a resource and apply the given template against it.
* If file resource is not found, tries to load the resource from classpath.
*
* @param path path to resource
* @param context context that the template uses
* @return the resource as a string
*/
public static String resourceFromHandleBarsTemplate(Path path, Object context) {
String str = IO.read(path);
if (str != null) {
str = Boon.handlebars(str, context);
}
return str;
}
代码示例来源:origin: io.fastjson/boon
/**
* Load a resource and apply the given template against it.
* If file resource is not found, tries to load the resource from classpath.
*
* @param path path to resource
* @param context context that the template uses
* @return the resource as a string
*/
public static String resourceFromHandleBarsTemplate(Path path, Object context) {
String str = IO.read(path);
if (str != null) {
str = Boon.handlebars(str, context);
}
return str;
}
代码示例来源:origin: boonproject/boon
/**
* Like puts, but prints out a whole slew of objects on the same
* line using the template if the message is a character sequence.
* Uses Handlebar style templates.
*
* @param messages objects you want to print on the same line.
*/
public static void puth(Object context, Object... messages) {
for (Object message : messages) {
if (message instanceof CharSequence) {
String transformedMessage =
handlebars(message.toString(), context);
print(message);
} else {
print(message);
}
print(' ');
}
println();
}
代码示例来源:origin: boonproject/boon
/**
* Like puts, but prints out a whole slew of objects on the same
* line using the template if the message is a character sequence.
* Uses Handlebar style templates.
*
* @param messages objects you want to print on the same line.
*/
public static void puth(Object context, Object... messages) {
for (Object message : messages) {
if (message instanceof CharSequence) {
String transformedMessage =
handlebars(message.toString(), context);
print(message);
} else {
print(message);
}
print(' ');
}
println();
}
代码示例来源:origin: io.fastjson/boon
/**
* Like puts, but prints out a whole slew of objects on the same
* line using the template if the message is a character sequence.
* Uses Handlebar style templates.
*
* @param messages objects you want to print on the same line.
*/
public static void puth(Object context, Object... messages) {
for (Object message : messages) {
if (message instanceof CharSequence) {
String transformedMessage =
handlebars(message.toString(), context);
print(message);
} else {
print(message);
}
print(' ');
}
println();
}
代码示例来源:origin: boonproject/boon
/**
* Load a resource and apply the given template against it.
* If file resource is not found, tries to load the resource from classpath.
*
* @param path path to resource
* @param context context that the template uses
* @return the resource as a string
*/
public static String resourceFromHandleBarsTemplate(String path, Object context) {
if (!IO.exists(IO.path(path))) {
path = add("classpath:/", path);
}
String str = IO.read(path);
if (str != null) {
str = Boon.handlebars(str, context);
}
return str;
}
代码示例来源:origin: boonproject/boon
/**
* Load a resource and apply the given template against it.
* If file resource is not found, tries to load the resource from classpath.
*
* @param path path to resource
* @param context context that the template uses
* @return the resource as a string
*/
public static String resourceFromHandleBarsTemplate(String path, Object context) {
if (!IO.exists(IO.path(path))) {
path = add("classpath:/", path);
}
String str = IO.read(path);
if (str != null) {
str = Boon.handlebars(str, context);
}
return str;
}
代码示例来源:origin: io.fastjson/boon
/**
* Load a resource and apply the given template against it.
* If file resource is not found, tries to load the resource from classpath.
*
* @param path path to resource
* @param context context that the template uses
* @return the resource as a string
*/
public static String resourceFromHandleBarsTemplate(String path, Object context) {
if (!IO.exists(IO.path(path))) {
path = add("classpath:/", path);
}
String str = IO.read(path);
if (str != null) {
str = Boon.handlebars(str, context);
}
return str;
}
内容来源于网络,如有侵权,请联系作者删除!