本文整理匯總了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;
}