本文整理了Java中com.typesafe.config.Config.getStringList()
方法的一些代码示例,展示了Config.getStringList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.getStringList()
方法的具体详情如下:
包路径:com.typesafe.config.Config
类名称:Config
方法名:getStringList
暂无
代码示例来源:origin: kairosdb/kairosdb
@Override
public List<?> extractListValue(Config config, String path) {
return config.getStringList(path);
}
},
代码示例来源:origin: kairosdb/kairosdb
public List<String> getStringList(String path)
{
return m_config.getStringList(path);
}
代码示例来源:origin: apache/drill
@Override
public List<String> getStringList(String path) {
return c.getStringList(path);
}
代码示例来源:origin: OryxProject/oryx
/**
* @param config configuration to query for value
* @param key configuration path key
* @return value for given key, or {@code null} if none exists
*/
public static List<String> getOptionalStringList(Config config, String key) {
return config.hasPath(key) ? config.getStringList(key) : null;
}
代码示例来源:origin: kairosdb/kairosdb
public List<String> getStringList(String path, List<String> def)
{
if (m_config.hasPath(path))
return m_config.getStringList(path);
else
return def;
}
代码示例来源:origin: ben-manes/caffeine
public Set<Admission> admission() {
return config().getStringList("admission").stream()
.map(String::toUpperCase)
.map(Admission::valueOf)
.collect(toSet());
}
代码示例来源:origin: ben-manes/caffeine
public Set<HillClimberType> strategy() {
return config().getStringList("hill-climber-window-tiny-lfu.strategy").stream()
.map(strategy -> strategy.replace('-', '_').toUpperCase(US))
.map(HillClimberType::valueOf)
.collect(toSet());
}
代码示例来源:origin: ben-manes/caffeine
public Set<String> policies() {
return config().getStringList("policies").stream()
.map(String::toLowerCase)
.collect(toSet());
}
代码示例来源:origin: ben-manes/caffeine
public List<String> paths() {
return config().getStringList("files.paths");
}
public TraceFormat format() {
代码示例来源:origin: ben-manes/caffeine
public Set<Eviction> policy() {
Set<Eviction> policies = new HashSet<>();
for (String policy : config().getStringList("ohc.policy")) {
String name = policy.toLowerCase(US).replaceAll("[^a-z]", "");
if (name.equals("lru")) {
policies.add(Eviction.LRU);
} else if (name.equals("wtinylfu")) {
policies.add(Eviction.W_TINY_LFU);
} else {
throw new IllegalArgumentException("Unknown policy: " + policy);
}
}
return policies;
}
}
代码示例来源:origin: ben-manes/caffeine
public Stream<Density> density() {
return config().getStringList("collision.density").stream()
.map(density -> Density.valueOf(density.toUpperCase(US)));
}
}
代码示例来源:origin: ethereum/ethereumj
@ValidateMe
public List<String> peerCapabilities() {
return config.getStringList("peer.capabilities");
}
代码示例来源:origin: ethereum/ethereumj
@ValidateMe
public List<String> peerDiscoveryIPList() {
return config.getStringList("peer.discovery.ip.list");
}
代码示例来源:origin: jooby-project/jooby
private List<String> strList(final String p) {
Object list = mail.getAnyRef(p);
if (list instanceof String) {
return ImmutableList.of(list.toString());
}
return mail.getStringList(p);
}
代码示例来源:origin: spotify/helios
public static CliConfig fromConfig(final Config config) {
checkNotNull(config);
final Map<String, Object> defaultSettings = ImmutableMap.of(
DOMAINS_KEY, EMPTY_STRING_LIST,
SRV_NAME_KEY, "helios",
MASTER_ENDPOINTS_KEY, EMPTY_STRING_LIST
);
final Config configWithDefaults = config.withFallback(ConfigFactory.parseMap(defaultSettings));
final List<String> domains = configWithDefaults.getStringList(DOMAINS_KEY);
final String srvName = configWithDefaults.getString(SRV_NAME_KEY);
final List<URI> masterEndpoints = Lists.newArrayList();
for (final String endpoint : configWithDefaults.getStringList(MASTER_ENDPOINTS_KEY)) {
masterEndpoints.add(URI.create(endpoint));
}
return new CliConfig(domains, srvName, masterEndpoints);
}
}
代码示例来源:origin: ben-manes/caffeine
/** Adds the entry listeners settings. */
private void addListeners() {
for (String path : merged.getStringList("listeners")) {
Config listener = root.getConfig(path);
Factory<? extends CacheEntryListener<? super K, ? super V>> listenerFactory =
factoryCreator.factoryOf(listener.getString("class"));
Factory<? extends CacheEntryEventFilter<? super K, ? super V>> filterFactory = null;
if (listener.hasPath("filter")) {
filterFactory = factoryCreator.factoryOf(listener.getString("filter"));
}
boolean oldValueRequired = listener.getBoolean("old-value-required");
boolean synchronous = listener.getBoolean("synchronous");
configuration.addCacheEntryListenerConfiguration(
new MutableCacheEntryListenerConfiguration<>(
listenerFactory, filterFactory, oldValueRequired, synchronous));
}
}
代码示例来源:origin: apache/incubator-gobblin
public Builder withReplicationReplica(Config config)
throws InstantiationException, IllegalAccessException, ClassNotFoundException {
Preconditions.checkArgument(config.hasPath(REPLICATION_REPLICAS),
"missing required config entery " + REPLICATION_REPLICAS);
Config replicasConfig = config.getConfig(REPLICATION_REPLICAS);
Preconditions.checkArgument(replicasConfig.hasPath(REPLICATOIN_REPLICAS_LIST),
"missing required config entery " + REPLICATOIN_REPLICAS_LIST);
List<String> replicaNames = replicasConfig.getStringList(REPLICATOIN_REPLICAS_LIST);
for (String replicaName : replicaNames) {
Preconditions.checkArgument(replicasConfig.hasPath(replicaName), "missing replica name " + replicaName);
Config subConfig = replicasConfig.getConfig(replicaName);
// each replica could have own EndPointFactory resolver
String endPointFactory = subConfig.hasPath(END_POINT_FACTORY_CLASS)
? subConfig.getString(END_POINT_FACTORY_CLASS) : DEFAULT_END_POINT_FACTORY_CLASS;
EndPointFactory factory = endPointFactoryResolver.resolveClass(endPointFactory).newInstance();
this.replicas.add(factory.buildReplica(subConfig, replicaName, this.selectionConfig));
}
return this;
}
代码示例来源:origin: spotify/apollo
@Inject
MetricsConfig(Config config) {
this.config = config;
if (config.hasPath("metrics.server")) {
enabledMetrics = parseConfig(config.getStringList("metrics.server"));
} else {
enabledMetrics = DEFAULT_ENABLED_METRICS;
}
if (config.hasPath("metrics.precreate-codes")) {
precreateCodes = new HashSet<>(config.getIntList("metrics.precreate-codes"));
} else {
precreateCodes = Collections.emptySet();
}
durationThresholdConfig = DurationThresholdConfig.parseConfig(config);
}
代码示例来源:origin: apache/incubator-gobblin
return ConfigFactory.parseString(includesBuilder.toString()).withFallback(ConfigFactory.defaultOverrides())
.withFallback(ConfigFactory.systemEnvironment()).withFallback(runtimeConfig.get()).resolve()
.getStringList(INCLUDES_KEY_NAME);
} else {
return ConfigFactory.parseString(includesBuilder.toString()).withFallback(ConfigFactory.defaultOverrides())
.withFallback(ConfigFactory.systemEnvironment()).resolve().getStringList(INCLUDES_KEY_NAME);
代码示例来源: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);
}
}
内容来源于网络,如有侵权,请联系作者删除!