本文整理了Java中org.boon.Boon.add()
方法的一些代码示例,展示了Boon.add()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Boon.add()
方法的具体详情如下:
包路径:org.boon.Boon
类名称:Boon
方法名:add
[英]Adds a bunch of Strings together.
[中]将一组字符串添加到一起。
代码示例来源:origin: boonproject/boon
/**
* Reads a configuration context from many possible roots.
* The roots can be filesystem or classpath://
*
* @param namespace namespace to load.
* @param path path to find config files.
* @param roots roots to find paths.
* @return context
*/
public static Context readConfig(String namespace, String path, String... roots) {
trace("readConfig(namespace, path, roots)", "IN", namespace, path, roots);
if (path.startsWith("/")) {
path = sliceOf(path, 1);
}
if (!path.endsWith(".json")) {
if (!path.endsWith("/")) {
path = add(path, "/");
}
}
ContextConfigReader contextConfigReader = ContextConfigReader.config().namespace(namespace);
for (String root : roots) {
if (!root.endsWith("/")) {
root = add(root, "/");
}
debug("readConfig", "adding root", root);
contextConfigReader.resource(add(root, path));
}
trace("readConfig(namespace, path, roots)", "OUT", namespace, path, roots);
return contextConfigReader.read();
}
代码示例来源:origin: io.fastjson/boon
/**
* Reads a configuration context from many possible roots.
* The roots can be filesystem or classpath://
*
* @param namespace namespace to load.
* @param path path to find config files.
* @param roots roots to find paths.
* @return context
*/
public static Context readConfig(String namespace, String path, String... roots) {
trace("readConfig(namespace, path, roots)", "IN", namespace, path, roots);
if (path.startsWith("/")) {
path = sliceOf(path, 1);
}
if (!path.endsWith(".json")) {
if (!path.endsWith("/")) {
path = add(path, "/");
}
}
ContextConfigReader contextConfigReader = ContextConfigReader.config().namespace(namespace);
for (String root : roots) {
if (!root.endsWith("/")) {
root = add(root, "/");
}
debug("readConfig", "adding root", root);
contextConfigReader.resource(add(root, path));
}
trace("readConfig(namespace, path, roots)", "OUT", namespace, path, roots);
return contextConfigReader.read();
}
代码示例来源:origin: boonproject/boon
/**
* Reads a configuration context from many possible roots.
* The roots can be filesystem or classpath://
*
* @param namespace namespace to load.
* @param path path to find config files.
* @param roots roots to find paths.
* @return context
*/
public static Context readConfig(String namespace, String path, String... roots) {
trace("readConfig(namespace, path, roots)", "IN", namespace, path, roots);
if (path.startsWith("/")) {
path = sliceOf(path, 1);
}
if (!path.endsWith(".json")) {
if (!path.endsWith("/")) {
path = add(path, "/");
}
}
ContextConfigReader contextConfigReader = ContextConfigReader.config().namespace(namespace);
for (String root : roots) {
if (!root.endsWith("/")) {
root = add(root, "/");
}
debug("readConfig", "adding root", root);
contextConfigReader.resource(add(root, path));
}
trace("readConfig(namespace, path, roots)", "OUT", namespace, path, roots);
return contextConfigReader.read();
}
代码示例来源:origin: boonproject/boon
/**
* Loads a resource from the file system or classpath if not found.
* This allows you to have resources that exist in the jar
* and that can be configured outside of the jar easily.
* <p/>
* Classpath is only used if file system resource is not found.
*
* @param path path to resource
* @return resource returned.
*/
public static String resource(String path) {
if (!IO.exists(IO.path(path))) {
path = add("classpath:/", path);
}
String str = IO.read(path);
return str;
}
代码示例来源:origin: boonproject/boon
/**
* Loads a resource from the file system or classpath if not found.
* This allows you to have resources that exist in the jar
* and that can be configured outside of the jar easily.
* <p/>
* Classpath is only used if file system resource is not found.
*
* @param path path to resource
* @return resource returned.
*/
public static String resource(String path) {
if (!IO.exists(IO.path(path))) {
path = add("classpath:/", path);
}
String str = IO.read(path);
return str;
}
代码示例来源:origin: io.fastjson/boon
/**
* Loads a resource from the file system or classpath if not found.
* This allows you to have resources that exist in the jar
* and that can be configured outside of the jar easily.
* <p/>
* Classpath is only used if file system resource is not found.
*
* @param path path to resource
* @return resource returned.
*/
public static String resource(String path) {
if (!IO.exists(IO.path(path))) {
path = add("classpath:/", path);
}
String str = IO.read(path);
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.
* Uses JSTL style template.
*
* @param path path to resource
* @param context context that the template uses
* @return the resource as a string
*/
public static String resourceFromTemplate(String path, Object context) {
if (!IO.exists(IO.path(path))) {
path = add("classpath:/", path);
}
String str = IO.read(path);
if (str != null) {
str = Boon.jstl(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.
* Uses JSTL style template.
*
* @param path path to resource
* @param context context that the template uses
* @return the resource as a string
*/
public static String resourceFromTemplate(String path, Object context) {
if (!IO.exists(IO.path(path))) {
path = add("classpath:/", path);
}
String str = IO.read(path);
if (str != null) {
str = Boon.jstl(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: boonproject/boon
/**
* Load JSON object as resource
* Looks in file system first and then classpath.
*
* @param path path to resource
* @return JSON object loaded as resource
*/
public static Object jsonResource(String path) {
if (!IO.exists(IO.path(path))) {
path = add("classpath:/", path);
}
String str = IO.read(path);
if (str != null) {
return fromJson(str);
}
return null;
}
代码示例来源:origin: boonproject/boon
/**
* Load JSON object as resource
* Looks in file system first and then classpath.
*
* @param path path to resource
* @return JSON object loaded as resource
*/
public static Object jsonResource(String path) {
if (!IO.exists(IO.path(path))) {
path = add("classpath:/", path);
}
String str = IO.read(path);
if (str != null) {
return fromJson(str);
}
return null;
}
代码示例来源:origin: boonproject/boon
add(System.getProperty("user.home"), "/.",
camelCaseLower(underBarCase(namespace)));
代码示例来源:origin: io.fastjson/boon
/**
* Load JSON object as resource
* Looks in file system first and then classpath.
*
* @param path path to resource
* @return JSON object loaded as resource
*/
public static Object jsonResource(String path) {
if (!IO.exists(IO.path(path))) {
path = add("classpath:/", path);
}
String str = IO.read(path);
if (str != null) {
return fromJson(str);
}
return null;
}
代码示例来源: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;
}
代码示例来源:origin: io.fastjson/boon
add(System.getProperty("user.home"), "/.",
camelCaseLower(underBarCase(namespace)));
代码示例来源: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.
* Uses JSTL style template.
*
* @param path path to resource
* @param context context that the template uses
* @return the resource as a string
*/
public static String resourceFromTemplate(String path, Object context) {
if (!IO.exists(IO.path(path))) {
path = add("classpath:/", path);
}
String str = IO.read(path);
if (str != null) {
str = Boon.jstl(str, context);
}
return str;
}
代码示例来源:origin: boonproject/boon
/**
* <p>
* Load JSON object as resource but first applies the template to the JSON file.
* LOAD STRING -> RUN TEMPLATE -> JSON PARSE.
* </p>
* Looks in file system first and then classpath.
*
* @param path path to resource
* @return JSON object loaded as resource
*/
public static Object jsonResourceFromTemplate(String path, Object context) {
if (!IO.exists(IO.path(path))) {
path = add("classpath:/", path);
}
String str = IO.read(path);
if (str != null) {
str = Boon.jstl(str, context);
return fromJson(str);
}
return null;
}
代码示例来源:origin: boonproject/boon
/**
* <p>
* Load JSON object as resource but first applies the template to the JSON file.
* LOAD STRING -> RUN TEMPLATE -> JSON PARSE.
* </p>
* Looks in file system first and then classpath.
*
* @param path path to resource
* @return JSON object loaded as resource
*/
public static Object jsonResourceFromTemplate(String path, Object context) {
if (!IO.exists(IO.path(path))) {
path = add("classpath:/", path);
}
String str = IO.read(path);
if (str != null) {
str = Boon.jstl(str, context);
return fromJson(str);
}
return null;
}
代码示例来源:origin: io.fastjson/boon
/**
* <p>
* Load JSON object as resource but first applies the template to the JSON file.
* LOAD STRING -> RUN TEMPLATE -> JSON PARSE.
* </p>
* Looks in file system first and then classpath.
*
* @param path path to resource
* @return JSON object loaded as resource
*/
public static Object jsonResourceFromTemplate(String path, Object context) {
if (!IO.exists(IO.path(path))) {
path = add("classpath:/", path);
}
String str = IO.read(path);
if (str != null) {
str = Boon.jstl(str, context);
return fromJson(str);
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!