本文整理匯總了Java中com.typesafe.config.Config.getObjectList方法的典型用法代碼示例。如果您正苦於以下問題:Java Config.getObjectList方法的具體用法?Java Config.getObjectList怎麽用?Java Config.getObjectList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.typesafe.config.Config
的用法示例。
在下文中一共展示了Config.getObjectList方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: readModuleShardsConfig
import com.typesafe.config.Config; //導入方法依賴的package包/類
private static Map<String, ModuleConfig.Builder> readModuleShardsConfig(final Config moduleShardsConfig) {
final List<? extends ConfigObject> moduleShardsConfigObjectList =
moduleShardsConfig.getObjectList("module-shards");
final Map<String, ModuleConfig.Builder> moduleConfigMap = new HashMap<>();
for (final ConfigObject moduleShardConfigObject : moduleShardsConfigObjectList) {
final String moduleName = moduleShardConfigObject.get("name").unwrapped().toString();
final ModuleConfig.Builder builder = ModuleConfig.builder(moduleName);
final List<? extends ConfigObject> shardsConfigObjectList =
moduleShardConfigObject.toConfig().getObjectList("shards");
for (final ConfigObject shard : shardsConfigObjectList) {
final String shardName = shard.get("name").unwrapped().toString();
final List<MemberName> replicas = shard.toConfig().getStringList("replicas").stream()
.map(MemberName::forName).collect(Collectors.toList());
builder.shardConfig(shardName, replicas);
}
moduleConfigMap.put(moduleName, builder);
}
return moduleConfigMap;
}
示例2: readModulesConfig
import com.typesafe.config.Config; //導入方法依賴的package包/類
private static void readModulesConfig(final Config modulesConfig,
final Map<String, ModuleConfig.Builder> moduleConfigMap, final Configuration configuration) {
final List<? extends ConfigObject> modulesConfigObjectList = modulesConfig.getObjectList("modules");
for (final ConfigObject o : modulesConfigObjectList) {
final ConfigObjectWrapper wrapper = new ConfigObjectWrapper(o);
final String moduleName = wrapper.stringValue("name");
final ModuleConfig.Builder builder = moduleConfigMap.computeIfAbsent(moduleName, ModuleConfig::builder);
builder.nameSpace(wrapper.stringValue("namespace"));
builder.shardStrategy(ShardStrategyFactory.newShardStrategyInstance(moduleName,
wrapper.stringValue("shard-strategy"), configuration));
}
}