本文整理了Java中com.typesafe.config.Config.getList()
方法的一些代码示例,展示了Config.getList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.getList()
方法的具体详情如下:
包路径:com.typesafe.config.Config
类名称:Config
方法名:getList
[英]Gets a list value (with any element type) as a ConfigList, which implements java.util.List. Throws if the path is unset or null.
[中]获取一个列表值(具有任何元素类型)作为ConfigList,它实现java。util。列表如果路径未设置或为null,则引发。
代码示例来源:origin: kairosdb/kairosdb
@Override
public Object extractValue(Config config, String path)
{
return config.getList(path);
}
},
代码示例来源:origin: kairosdb/kairosdb
@Override
public List<?> extractListValue(Config config, String path) {
return config.getList(path);
}
}
代码示例来源:origin: apache/drill
@Override
public ConfigList getList(String path) {
return c.getList(path);
}
代码示例来源:origin: apache/drill
public int clusterGroupCount() {
return config.getList(CLUSTERS).size();
}
代码示例来源:origin: apache/drill
ConfigList tiers = config.getList(DrillOnYarnConfig.CLUSTERS);
ConfigValue value = tiers.get(n);
if ( value == null ) {
代码示例来源:origin: atomix/atomix
return config.getValue(configPropName);
} else if (parameterClass == ConfigList.class) {
return config.getList(configPropName);
} else if (parameterClass == Class.class) {
String className = config.getString(configPropName);
代码示例来源:origin: mpusher/mpush
return config.getValue(configPropName);
} else if (parameterClass == ConfigList.class) {
return config.getList(configPropName);
} else if (hasAtLeastOneBeanProperty(parameterClass)) {
return createInternal(config.getConfig(configPropName), parameterClass);
代码示例来源: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: racc/typesafeconfig-guice
@Override
public List<?> extractListValue(Config config, String path) {
return config.getList(path);
}
}
代码示例来源:origin: dremio/dremio-oss
@Override
public ConfigList getList(String path) {
return config.getList(path);
}
代码示例来源:origin: racc/typesafeconfig-guice
@Override
public Object extractValue(Config config, String path) {
return config.getList(path);
}
},
代码示例来源:origin: org.apache.drill/drill-common
@Override
public ConfigList getList(String path) {
return c.getList(path);
}
代码示例来源:origin: kompics/kompics
@Override
public List<? extends ConfigValue> getValues(String path) {
ConfigList cl = config.getList(path);
if (cl != null) {
List<ConfigValue> l = new LinkedList<>();
for (com.typesafe.config.ConfigValue cv : cl) {
l.add(new TypesafeValue(cv));
}
return l;
} else {
return null;
}
}
代码示例来源:origin: com.github.ddth/ddth-commons-core
/**
* Get a configuration as list of Values. Return {@code null} if missing or wrong type.
*
* @param config
* @param path
* @return
*/
public static ConfigList getValueList(Config config, String path) {
try {
return config.getList(path);
} catch (ConfigException.Missing | ConfigException.WrongType e) {
if (e instanceof ConfigException.WrongType) {
LOGGER.warn(e.getMessage(), e);
}
return null;
}
}
代码示例来源:origin: at.molindo/helios-testing
private static List<String> getListByKey(final String key, final Config config) {
final ConfigList endpointList = config.getList(key);
final List<String> stringList = Lists.newArrayList();
for (final ConfigValue v : endpointList) {
if (v.valueType() != ConfigValueType.STRING) {
throw new RuntimeException("Item in " + key + " list [" + v + "] is not a string");
}
stringList.add((String) v.unwrapped());
}
return stringList;
}
代码示例来源:origin: yahoo/gondola
public List<String> getList(String path) {
return configData.cfg.getList(path).stream()
.map(configValue -> String.valueOf(configValue.unwrapped()))
.collect(Collectors.toList());
}
代码示例来源:origin: cloudera-labs/envelope
@Override
public void configure(Config config) {
LOGGER.debug("Configuring in-list deriver with " + config.toString());
if (config.hasPath(INLIST_STEP_CONFIG)) {
stepName = config.getString(INLIST_STEP_CONFIG);
}
if (config.hasPath(INLIST_FIELD_CONFIG)) {
fieldName = config.getString(INLIST_FIELD_CONFIG);
}
if (config.hasPath(INLIST_VALUES_CONFIG)) {
inList = config.getList(INLIST_VALUES_CONFIG).unwrapped();
inListType = InListType.LITERAL;
} else if (config.hasPath(INLIST_REFSTEP_CONFIG)) {
refStepName = config.getString(INLIST_REFSTEP_CONFIG);
if (config.hasPath(INLIST_REFFIELD_CONFIG)) {
refFieldName = config.getString(INLIST_REFFIELD_CONFIG);
}
inListType = InListType.REFERENCE;
}
}
代码示例来源:origin: Erudika/para
private IgnoredRequestMatcher() {
ConfigList c = Config.getConfig().getList("security.ignored");
List<RequestMatcher> list = new ArrayList<>(c.size());
for (ConfigValue configValue : c) {
list.add(new AntPathRequestMatcher((String) configValue.unwrapped()));
}
orMatcher = new OrRequestMatcher(list);
}
代码示例来源:origin: com.erudika/para
private IgnoredRequestMatcher() {
ConfigList c = Config.getConfig().getList("security.ignored");
List<RequestMatcher> list = new ArrayList<RequestMatcher>(c.size());
for (ConfigValue configValue : c) {
list.add(new AntPathRequestMatcher((String) configValue.unwrapped()));
}
orMatcher = new OrRequestMatcher(list);
}
代码示例来源:origin: com.erudika/para-server
private IgnoredRequestMatcher() {
ConfigList c = Config.getConfig().getList("security.ignored");
List<RequestMatcher> list = new ArrayList<>(c.size());
for (ConfigValue configValue : c) {
list.add(new AntPathRequestMatcher((String) configValue.unwrapped()));
}
orMatcher = new OrRequestMatcher(list);
}
内容来源于网络,如有侵权,请联系作者删除!