本文整理汇总了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));
}
}