本文整理汇总了Java中com.typesafe.config.Config.getObject方法的典型用法代码示例。如果您正苦于以下问题:Java Config.getObject方法的具体用法?Java Config.getObject怎么用?Java Config.getObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.typesafe.config.Config
的用法示例。
在下文中一共展示了Config.getObject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadQueryPlanPatterns
import com.typesafe.config.Config; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private Map<Language, List<QueryPlanPatterns>> loadQueryPlanPatterns(Config config) {
Map<Language, List<QueryPlanPatterns>> rulesByLang = new LinkedHashMap<>();
ConfigObject configObject = config.getObject("rules.planner-pattern");
configObject.keySet().forEach(strLang -> {
Language language = Language.valueOf(strLang.toUpperCase());
List<QueryPlanPatterns> plans = new ArrayList<>();
List<? extends ConfigObject> innerCfg = configObject.toConfig().getObjectList(strLang);
innerCfg.forEach(e -> {
Map<String, Object> plan = e.unwrapped();
String planId = plan.keySet().toArray(new String[1])[0];
List<String> triplePatterns = (List<String>)plan.values().toArray()[0];
plans.add(new QueryPlanPatterns(planId,
triplePatterns.stream().map(TriplePattern::new).collect(Collectors.toList())));
});
rulesByLang.put(language, plans);
});
return rulesByLang;
}
示例2: loadStopPatterns
import com.typesafe.config.Config; //导入方法依赖的package包/类
private Map<Language, List<Pattern>> loadStopPatterns(Config config) {
Map<Language, List<Pattern>> rulesByLang = new LinkedHashMap<>();
ConfigObject configObject = config.getObject("rules.stop-pattern");
configObject.keySet().forEach(strLang -> {
Language language = Language.valueOf(strLang.toUpperCase());
List<String> patternStr = configObject.toConfig().getStringList(strLang);
rulesByLang.compute(language,
(lang, pattern) -> patternStr.stream().map(Pattern::compile).collect(Collectors.toList()));
logger.info(marker, "Loaded {} Stop patterns for '{}'", rulesByLang.get(language).size(), language);
});
return rulesByLang;
}
示例3: loadDataModelTypePatterns
import com.typesafe.config.Config; //导入方法依赖的package包/类
private Map<Language, List<DataModelTypePattern>> loadDataModelTypePatterns(Config config) {
Map<Language, List<DataModelTypePattern>> rulesByLang = new HashMap<>();
ConfigObject configObject = config.getObject("rules.syntatic-pattern");
configObject.keySet().forEach(strLang -> {
Language language = Language.valueOf(strLang.toUpperCase());
rulesByLang.compute(language, (l, r) -> {
List<DataModelTypePattern> rules = new ArrayList<>();
List<? extends Config> patternCfg = configObject.toConfig().getConfigList(strLang);
for (Config cfg : patternCfg) {
Map.Entry<String, ConfigValue> entry = cfg.entrySet().stream().findFirst().orElse(null);
String modelStr = entry.getKey();
@SuppressWarnings("unchecked")
List<String> patternList = (List<String>) entry.getValue().unwrapped();
rules.addAll(patternList.stream()
.map(p -> new DataModelTypePattern(p, DataModelType.valueOf(modelStr)))
.collect(Collectors.toList()));
}
logger.info(marker, "Loaded {} Data Model Type patterns for '{}'", rules.size(), l);
return rules;
});
});
return rulesByLang;
}
示例4: loadQueryTypePatterns
import com.typesafe.config.Config; //导入方法依赖的package包/类
private Map<Language, List<QueryTypePatterns>> loadQueryTypePatterns(Config config) {
Map<Language, List<QueryTypePatterns>> rulesByLang = new HashMap<>();
ConfigObject configObject = config.getObject("rules.query-pattern");
configObject.keySet().forEach(strLang -> {
Language language = Language.valueOf(strLang.toUpperCase());
ConfigObject innerCfg = configObject.toConfig().getObject(strLang);
List<QueryTypePatterns> patterns = new ArrayList<>();
rulesByLang.compute(language, (l, q) -> {
innerCfg.keySet().forEach(key -> {
QueryType queryType = QueryType.valueOf(key);
List<String> patternStr = innerCfg.toConfig().getStringList(key);
patterns.add(new QueryTypePatterns(queryType,
patternStr.stream().map(Pattern::compile).collect(Collectors.toList())));
});
logger.info(marker, "Loaded {} Query Type patterns for '{}'", patterns.size(), language);
return patterns;
});
});
return rulesByLang;
}