com.typesafe.config.Config.getConfigList()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(257)

本文整理了Java中com.typesafe.config.Config.getConfigList()方法的一些代码示例,展示了Config.getConfigList()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.getConfigList()方法的具体详情如下:
包路径:com.typesafe.config.Config
类名称:Config
方法名:getConfigList

Config.getConfigList介绍

暂无

代码示例

代码示例来源:origin: kairosdb/kairosdb

@Override
  public List<?> extractListValue(Config config, String path) {
    return config.getConfigList(path);
  }
},

代码示例来源:origin: apache/drill

@Override
public List<? extends Config> getConfigList(String path) {
 return c.getConfigList(path);
}

代码示例来源:origin: kairosdb/kairosdb

public List<KairosConfig> getConfigList(String path)
{
  List<? extends Config> configList = m_config.getConfigList(path);
  ArrayList<KairosConfig> ret = new ArrayList<>();
  for (Config config : configList)
  {
    ret.add(new KairosConfig(config));
  }
  return ret;
}

代码示例来源:origin: apache/incubator-gobblin

List<? extends Config> retainedConfigs = setupConfig.getConfigList(TEST_DATA_VALIDATE_RETAINED_KEY);
for (Config retainedConfig : retainedConfigs) {
 Path fullFilePath =
List<? extends Config> deletedConfigs = setupConfig.getConfigList(TEST_DATA_VALIDATE_DELETED_KEY);
for (Config retainedConfig : deletedConfigs) {
 Path fullFilePath =
 List<? extends Config> permissionsConfigs = setupConfig.getConfigList(TEST_DATA_VALIDATE_PERMISSIONS_KEY);
 for (Config permissionsConfig : permissionsConfigs) {
  Path fullFilePath =

代码示例来源:origin: apache/incubator-gobblin

/**
 * Creates a new ConfigurableCleanableDataset configured through gobblin-config-management. The constructor expects
 * {@link #VERSION_FINDER_CLASS_KEY} and {@link #RETENTION_POLICY_CLASS_KEY} to be available in the
 * <code>config</code> passed.
 */
public ConfigurableCleanableDataset(FileSystem fs, Properties jobProps, Path datasetRoot, Config config, Logger log)
  throws IOException {
 super(fs, jobProps, config, log);
 this.datasetRoot = datasetRoot;
 this.versionFindersAndPolicies = Lists.newArrayList();
 if (config.hasPath(DATASET_VERSION_POLICY_ALIAS)) {
  initWithSelectionPolicy(config.getConfig(DATASET_VERSION_POLICY_ALIAS), jobProps);
 } else if (config.hasPath(VERSION_FINDER_CLASS_KEY) && config.hasPath(RETENTION_POLICY_CLASS_KEY)) {
  initWithRetentionPolicy(config, jobProps, RETENTION_POLICY_CLASS_KEY, VERSION_FINDER_CLASS_KEY);
 } else if (config.hasPath(VERSION_FINDER_CLASS_KEY)) {
  initWithSelectionPolicy(config.getConfig(RETENTION_CONFIGURATION_KEY), jobProps);
 } else if (config.hasPath(DATASET_PARTITIONS_LIST_KEY)) {
  List<? extends Config> versionAndPolicies = config.getConfigList(DATASET_PARTITIONS_LIST_KEY);
  for (Config versionAndPolicy : versionAndPolicies) {
   initWithSelectionPolicy(versionAndPolicy, jobProps);
  }
 } else {
  throw new IllegalArgumentException(
    String.format("Either set version finder at %s and retention policy at %s or set partitions at %s",
      VERSION_FINDER_CLASS_KEY, RETENTION_POLICY_CLASS_KEY, DATASET_PARTITIONS_LIST_KEY));
 }
}

代码示例来源:origin: jooby-project/jooby

@SuppressWarnings("unchecked")
private Config dbconf(final Config conf, final String type) {
 try {
  String dbtype = "databases." + type;
  ConfigValue value = conf.getValue(dbtype);
  if (value.valueType() == ConfigValueType.OBJECT) {
   return ((ConfigObject) value).toConfig();
  }
  List<Config> list = (List<Config>) conf.getConfigList(dbtype);
  ClassLoader loader = getClass().getClassLoader();
  return list.stream()
    .filter(it -> dataSourcePresent(loader, it.getString("dataSourceClassName")))
    .findFirst()
    .orElse(list.get(0));
 } catch (ConfigException.Missing | ConfigException.BadPath x) {
  return ConfigFactory.empty();
 }
}

代码示例来源:origin: apache/incubator-gobblin

List<? extends Config> createConfigs = setupConfig.getConfigList(TEST_DATA_CREATE_KEY);

代码示例来源:origin: jooby-project/jooby

List<Config> modules = new ArrayList<>();
if (raw.valueType() == ConfigValueType.LIST) {
 modules.addAll(conf.getConfigList("com.graphaware.module"));
} else {
 modules.add(conf.getConfig("com.graphaware.module"));

代码示例来源:origin: kairosdb/kairosdb

return Optional.of(extractedListValue.get());
} else {
  List<? extends Config> configList = config.getConfigList(path);
  return Optional.of(configList.stream()
      .map(cfg -> {

代码示例来源:origin: atomix/atomix

} else {
 List<Object> beanList = new ArrayList<>();
 List<? extends Config> configList = config.getConfigList(configPropName);
 int i = 0;
 for (Config listMember : configList) {

代码示例来源:origin: mpusher/mpush

private static Object getListValue(Class<?> beanClass, Type parameterType, Class<?> parameterClass, Config config, String configPropName) {
  Type elementType = ((ParameterizedType) parameterType).getActualTypeArguments()[0];
  if (elementType == Boolean.class) {
    return config.getBooleanList(configPropName);
  } else if (elementType == Integer.class) {
    return config.getIntList(configPropName);
  } else if (elementType == Double.class) {
    return config.getDoubleList(configPropName);
  } else if (elementType == Long.class) {
    return config.getLongList(configPropName);
  } else if (elementType == String.class) {
    return config.getStringList(configPropName);
  } else if (elementType == Duration.class) {
    return config.getDurationList(configPropName);
  } else if (elementType == ConfigMemorySize.class) {
    return config.getMemorySizeList(configPropName);
  } else if (elementType == Object.class) {
    return config.getAnyRefList(configPropName);
  } else if (elementType == Config.class) {
    return config.getConfigList(configPropName);
  } else if (elementType == ConfigObject.class) {
    return config.getObjectList(configPropName);
  } else if (elementType == ConfigValue.class) {
    return config.getList(configPropName);
  } else {
    throw new ConfigException.BadBean("Bean property '" + configPropName + "' of class " + beanClass.getName() + " has unsupported list element type " + elementType);
  }
}

代码示例来源:origin: Netflix/spectator

/**
 * Create a value function based on a config.
 */
public static SparkValueFunction fromConfig(Config config, String key) {
 return fromPatternList(config.getConfigList(key));
}

代码示例来源:origin: Netflix/spectator

/**
 * Create a name function based on a config.
 */
public static SparkNameFunction fromConfig(Config config, String key, Registry registry) {
 return fromPatternList(config.getConfigList(key), registry);
}

代码示例来源:origin: Netflix/spectator

/** Create from a Typesafe Config object. */
static JmxMeasurementConfig from(Config config) {
 String name = config.getString("name");
 Map<String, String> tags = config.getConfigList("tags")
   .stream()
   .collect(Collectors.toMap(c -> c.getString("key"), c -> c.getString("value")));
 String value = config.getString("value");
 boolean counter = config.hasPath("counter") && config.getBoolean("counter");
 return new JmxMeasurementConfig(name, tags, value, counter);
}

代码示例来源:origin: kite-sdk/kite

public List<? extends Config> getConfigList(Config config, String path, List<? extends Config> defaults) {
 addRecognizedArgument(path);
 if (config.hasPath(path)) {
  return config.getConfigList(path);
 } else {
  return defaults;
 }
}

代码示例来源:origin: io.skullabs.uworkers/uworkers

public List<Configuration> getConfigList( final String name ) {
  final List<Configuration> newConfigList = new ArrayList<Configuration>();
  try {
    for ( Config config : this.mergeableConfig.getConfigList(name) )
      newConfigList.add( new DefaultConfiguration(config) );
  } catch ( Missing cause ) {
    log.warning( "No values found for " + name + ". Returning an empty list." );
  }
  return newConfigList;
}

代码示例来源:origin: hank-whu/turbo-rpc

public static ClientConfig parse(String resourceName) {

    ClientConfig clientConfig = new ClientConfig();

    Config config = ConfigFactory.load(resourceName);

    List<AppConfig> appConfigList = AppConfig.parse(config.getConfigList("apps"));

    clientConfig.setAppConfigList(appConfigList);

    return clientConfig;
  }
}

代码示例来源:origin: Netflix/spectator

private List<JmxConfig> configs() {
 List<JmxConfig> cfgs = new ArrayList<>();
 for (Config cfg : config.getConfigList("netflix.spectator.agent.jmx.mappings")) {
  cfgs.add(JmxConfig.from(cfg));
 }
 return cfgs;
}

代码示例来源:origin: kite-sdk/kite

protected Config parse(String file, Config... overrides) throws IOException {
 Config config = new Compiler().parse(new File(RESOURCES_DIR + "/" + file + ".conf"), overrides);
 config = config.getConfigList("morphlines").get(0);
 Preconditions.checkNotNull(config);
 return config;
}

代码示例来源:origin: kite-sdk/kite

protected Command parse(String file, String collection) throws IOException {
 SolrLocator locator = new SolrLocator(createMorphlineContext());
 locator.setCollectionName(collection);
 locator.setZkHost(cluster.getZkServer().getZkAddress());
 //locator.setServerUrl(cloudJettys.get(0).url); // TODO: download IndexSchema from solrUrl not yet implemented
 //locator.setSolrHomeDir(SOLR_HOME_DIR.getPath());
 Config config = new Compiler().parse(new File(RESOURCES_DIR + "/" + file + ".conf"), locator.toConfig("SOLR_LOCATOR"));
 config = config.getConfigList("morphlines").get(0);
 return createMorphline(config);
}

相关文章