本文整理汇总了Java中org.apache.commons.lang3.text.StrSubstitutor.setEnableSubstitutionInVariables方法的典型用法代码示例。如果您正苦于以下问题:Java StrSubstitutor.setEnableSubstitutionInVariables方法的具体用法?Java StrSubstitutor.setEnableSubstitutionInVariables怎么用?Java StrSubstitutor.setEnableSubstitutionInVariables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.text.StrSubstitutor
的用法示例。
在下文中一共展示了StrSubstitutor.setEnableSubstitutionInVariables方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadConfigFromEnv
import org.apache.commons.lang3.text.StrSubstitutor; //导入方法依赖的package包/类
public static <T> T loadConfigFromEnv(Class<T> configurationClass, final String path)
throws IOException {
LOGGER.info("Parsing configuration file from {} ", path);
logProcessEnv();
final Path configPath = Paths.get(path);
final File file = configPath.toAbsolutePath().toFile();
final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
final StrSubstitutor sub = new StrSubstitutor(new StrLookup<Object>() {
@Override
public String lookup(String key) {
return System.getenv(key);
}
});
sub.setEnableSubstitutionInVariables(true);
final String conf = sub.replace(FileUtils.readFileToString(file));
return mapper.readValue(conf, configurationClass);
}
示例2: initialize
import org.apache.commons.lang3.text.StrSubstitutor; //导入方法依赖的package包/类
@Override
public void initialize(Bootstrap<MutableSchedulerConfiguration> bootstrap) {
super.initialize(bootstrap);
StrSubstitutor strSubstitutor = new StrSubstitutor(new EnvironmentVariableLookup(false));
strSubstitutor.setEnableSubstitutionInVariables(true);
bootstrap.addBundle(new Java8Bundle());
bootstrap.setConfigurationSourceProvider(
new SubstitutingSourceProvider(
bootstrap.getConfigurationSourceProvider(),
strSubstitutor));
}
示例3: processTemplate
import org.apache.commons.lang3.text.StrSubstitutor; //导入方法依赖的package包/类
public String processTemplate(String template, Map<String, String> values) {
StrSubstitutor strSubstitutor = new StrSubstitutor(values);
strSubstitutor.setEnableSubstitutionInVariables(true);
return strSubstitutor.replace(template);
}
示例4: createChatMessage
import org.apache.commons.lang3.text.StrSubstitutor; //导入方法依赖的package包/类
private static Text createChatMessage(Player player, Player recipient, Text rawMessage) {
String chatFormat = RPChat.get().getConfig().getChatFormat();
StrSubstitutor sub = new StrSubstitutor(new MessageVarLookup(player, recipient, rawMessage));
sub.setEnableSubstitutionInVariables(true);
return TextSerializers.FORMATTING_CODE.deserializeUnchecked(sub.replace(chatFormat));
}
示例5: processTemplate
import org.apache.commons.lang3.text.StrSubstitutor; //导入方法依赖的package包/类
public String processTemplate(String template, Map<String, String> values)
{
StrSubstitutor strSubstitutor = new StrSubstitutor(values);
strSubstitutor.setEnableSubstitutionInVariables(true);
return strSubstitutor.replace(template);
}