本文整理匯總了Java中org.apache.commons.lang3.text.StrSubstitutor.replaceSystemProperties方法的典型用法代碼示例。如果您正苦於以下問題:Java StrSubstitutor.replaceSystemProperties方法的具體用法?Java StrSubstitutor.replaceSystemProperties怎麽用?Java StrSubstitutor.replaceSystemProperties使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.lang3.text.StrSubstitutor
的用法示例。
在下文中一共展示了StrSubstitutor.replaceSystemProperties方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: generateClasspath
import org.apache.commons.lang3.text.StrSubstitutor; //導入方法依賴的package包/類
private static List<String> generateClasspath(String classPath) throws FileNotFoundException {
List<String> urlStr = new ArrayList<>();
String realClassPath = StrSubstitutor.replaceSystemProperties(classPath);
File classPathUrl = new File(realClassPath);
if (!classPathUrl.exists()) {
throw new FileNotFoundException("The classpath: " + realClassPath + " does not exist.");
}
if (classPathUrl.isFile()) {
urlStr.add(classPathUrl.toURI().toString());
return urlStr;
}
FileUtils.listFiles(classPathUrl, new String[] { "jar" }, false)
.forEach((file) -> urlStr.add(file.toURI().toString()));
return urlStr;
}
示例2: testCreateMetadata
import org.apache.commons.lang3.text.StrSubstitutor; //導入方法依賴的package包/類
@Test
public void testCreateMetadata() throws Exception {
String entity = StrSubstitutor.replaceSystemProperties(loadResource("./metadata/test.json"));
String response = createRequest((ResteasyClient client) -> {
return client
.target(getMetadataUrl())
.path("/test/1.0.0");
}).put(Entity.entity(entity, MediaType.APPLICATION_JSON), String.class);
assertNotNull(response);
JSONAssert.assertEquals(
"{\"entityInfo\":{\"name\":\"test\",\"defaultVersion\":\"1.0.0\",\"indexes\":[{\"name\":null,\"unique\":true,\"fields\":[{\"field\":\"_id\",\"dir\":\"$asc\",\"caseInsensitive\":false}]}],\"datastore\":{\"datasource\":\"mongo\",\"collection\":\"test\",\"backend\":\"mongo\"},\"_id\":\"test|\"},\"schema\":{\"name\":\"test\",\"version\":{\"value\":\"1.0.0\",\"changelog\":\"test metadata\"},\"status\":{\"value\":\"active\"},\"access\":{\"insert\":[\"anyone\"],\"update\":[\"anyone\"],\"find\":[\"anyone\"],\"delete\":[\"anyone\"]},\"fields\":{\"_id\":{\"type\":\"string\",\"description\":null,\"valueGenerator\":{\"type\":\"UUID\"}},\"value\":{\"type\":\"string\",\"description\":null},\"objectType\":{\"type\":\"string\",\"description\":null,\"access\":{\"find\":[\"anyone\"],\"update\":[\"noone\"]},\"constraints\":{\"required\":true,\"minLength\":1}}},\"_id\":\"test|1.0.0\"}}",
response,
true);
}
示例3: json
import org.apache.commons.lang3.text.StrSubstitutor; //導入方法依賴的package包/類
public static JsonNode json(String s, boolean systemPropertySubstitution)
throws IOException {
String jsonString;
if (systemPropertySubstitution) {
// do system property expansion
jsonString = StrSubstitutor.replaceSystemProperties(s);
} else {
jsonString = s;
}
return getObjectMapper().readTree(jsonString);
}
示例4: replacePlaceholdersWithWhiteSpace
import org.apache.commons.lang3.text.StrSubstitutor; //導入方法依賴的package包/類
public static String replacePlaceholdersWithWhiteSpace(final String templateContent) {
return StrSubstitutor.replaceSystemProperties(templateContent);
}
示例5: expandEnvVars
import org.apache.commons.lang3.text.StrSubstitutor; //導入方法依賴的package包/類
/**
* Resolve variable given name to a global variable. Global variables are referenced using: ${var} convention.
*
* @param text
* object to use
* @return resolved variable or itself if not a variable
*/
public String expandEnvVars(String text) {
return StrSubstitutor.replaceSystemProperties(sub.replace(text));
}