本文整理汇总了Java中com.typesafe.config.ConfigValueType.LIST属性的典型用法代码示例。如果您正苦于以下问题:Java ConfigValueType.LIST属性的具体用法?Java ConfigValueType.LIST怎么用?Java ConfigValueType.LIST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.typesafe.config.ConfigValueType
的用法示例。
在下文中一共展示了ConfigValueType.LIST属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
/**
* Initializes the configuration class by loading the configuration file.
* @param conf overrides the default configuration
*/
public static void init(com.typesafe.config.Config conf) {
try {
config = ConfigFactory.load().getConfig(PARA);
if (conf != null) {
config = conf.withFallback(config);
}
configMap = new HashMap<>();
for (Map.Entry<String, ConfigValue> con : config.entrySet()) {
if (con.getValue().valueType() != ConfigValueType.LIST) {
configMap.put(con.getKey(), config.getString(con.getKey()));
}
}
} catch (Exception ex) {
logger.warn("Para configuration file 'application.(conf|json|properties)' is missing from classpath.");
config = com.typesafe.config.ConfigFactory.empty();
}
}
示例2: HoconTreeTraversingParser
public HoconTreeTraversingParser(ConfigObject n, ObjectCodec codec)
{
super(0);
_rootObject = n;
_objectCodec = codec;
if (n.valueType() == ConfigValueType.LIST) {
_nextToken = JsonToken.START_ARRAY;
_nodeCursor = new HoconNodeCursor.Array(n, null);
} else if (n.valueType() == ConfigValueType.OBJECT) {
if (HoconNodeCursor.isNumericallyIndexed(n)) {
_nextToken = JsonToken.START_ARRAY;
_nodeCursor = new HoconNodeCursor.NumericallyIndexedObjectBackedArray(n, null);
} else {
_nextToken = JsonToken.START_OBJECT;
_nodeCursor = new HoconNodeCursor.Object(n, null);
}
} else { // value node
_nodeCursor = new HoconNodeCursor.RootValue(n, null);
}
}
示例3: getValueTypeOrNull
private static ConfigValueType getValueTypeOrNull(Class<?> parameterClass) {
if (parameterClass == Boolean.class || parameterClass == boolean.class) {
return ConfigValueType.BOOLEAN;
} else if (parameterClass == Integer.class || parameterClass == int.class) {
return ConfigValueType.NUMBER;
} else if (parameterClass == Double.class || parameterClass == double.class) {
return ConfigValueType.NUMBER;
} else if (parameterClass == Long.class || parameterClass == long.class) {
return ConfigValueType.NUMBER;
} else if (parameterClass == String.class) {
return ConfigValueType.STRING;
} else if (parameterClass == Duration.class) {
return null;
} else if (parameterClass == ConfigMemorySize.class) {
return null;
} else if (parameterClass == List.class) {
return ConfigValueType.LIST;
} else if (parameterClass == Map.class) {
return ConfigValueType.OBJECT;
} else if (parameterClass == Config.class) {
return ConfigValueType.OBJECT;
} else if (parameterClass == ConfigObject.class) {
return ConfigValueType.OBJECT;
} else if (parameterClass == ConfigList.class) {
return ConfigValueType.LIST;
} else {
return null;
}
}
示例4: currentHasChildren
@Override
public boolean currentHasChildren() {
// note: ONLY to be called for container nodes
ConfigValue currentValue = currentNode();
if (currentValue.valueType() == ConfigValueType.LIST) {
return !((ConfigList) currentValue).isEmpty();
} else {
return !((ConfigObject) currentValue).isEmpty();
}
}
示例5: isArray
protected static boolean isArray(ConfigValue value) {
return value.valueType() == ConfigValueType.LIST;
}