Package com.typesafe.config

Examples of com.typesafe.config.ConfigList


                Object[] asArray = (Object[]) hydrateArray(vc, field.getName(), config);
                Collections.addAll(col, asArray);
            }
        } else {
            // autocollection is a little ambiguous for nested lists, so just don't support
            ConfigList configValues = config.getList(field.getName());
            for (ConfigValue configValue : configValues) {
                Config arrayContainer = configValue.atKey("array");
                Object arrayValue = hydrateArray(vc, "array", arrayContainer);
                col.add(arrayValue);
            }
View Full Code Here


    private static ConfigList expandSugarArray(ConfigValue fieldValue,
                                                 Class<?> elementType,
                                                 CodecConfig codec,
                                                 boolean nested) {
        ConfigList fieldList = (ConfigList) fieldValue;
        List<Object> newList = new ArrayList<>(fieldList.size());
        for (ConfigValue listEntry : fieldList) {
            ConfigValue listObject;
            if (nested) {
                listObject = expandSugarArray(listEntry, elementType, codec, false);
            } else {
                listObject = expandSugar(elementType, listEntry, codec);
            }
            newList.add(listObject.unwrapped());
        }
        return ConfigValueFactory.fromIterable(newList, fieldList.origin().description());
    }
View Full Code Here

            break;
        case STRING:
            out.writeUTF(((ConfigString) value).unwrapped());
            break;
        case LIST:
            ConfigList list = (ConfigList) value;
            out.writeInt(list.size());
            for (ConfigValue v : list) {
                writeValue(out, v, (SimpleConfigOrigin) list.origin());
            }
            break;
        case OBJECT:
            ConfigObject obj = (ConfigObject) value;
            out.writeInt(obj.size());
View Full Code Here

            return booleanArray;
        } else if (Number.class.isAssignableFrom(componentType|| componentType.isPrimitive()) {
            // primitive numeric types are not subclasses of Number, so just catch all non-booleans
            return hydrateNumberArray(componentType, fieldName, config);
        } else {
            ConfigList configValues = config.getList(fieldName);
            Object[] customs = (Object[]) Array.newInstance(componentType, configValues.size());
            int index = 0;
            for (ConfigValue value : configValues) {
                if ((value == null) || (value.valueType() == ConfigValueType.NULL)) {
                    customs[index++] = null;
                } else {
View Full Code Here

                Object[] asArray = (Object[]) hydrateArray(vc, field.getName(), config);
                Collections.addAll(col, asArray);
            }
        } else {
            // autocollection is a little ambiguous for nested lists, so just don't support
            ConfigList configValues = config.getList(field.getName());
            for (ConfigValue configValue : configValues) {
                Config arrayContainer = configValue.atKey("array");
                Object arrayValue = hydrateArray(vc, "array", arrayContainer);
                col.add(arrayValue);
            }
View Full Code Here

    private static ConfigList expandSugarArray(ConfigValue fieldValue,
                                                 Class<?> elementType,
                                                 CodecConfig codec,
                                                 boolean nested) {
        ConfigList fieldList = (ConfigList) fieldValue;
        List<Object> newList = new ArrayList<>(fieldList.size());
        for (ConfigValue listEntry : fieldList) {
            ConfigValue listObject;
            if (nested) {
                listObject = expandSugarArray(listEntry, elementType, codec, false);
            } else {
                listObject = expandSugar(elementType, listEntry, codec);
            }
            newList.add(listObject.unwrapped());
        }
        return ConfigValueFactory.fromIterable(newList, fieldList.origin().description());
    }
View Full Code Here

                        } else {
                            break;
                        }
                    } else if (locRef instanceof ConfigList) {
                        int fieldIndex = path.getIndex();
                        ConfigList locRefList = (ConfigList) locRef;
                        if ((fieldIndex >= 0) && (locRefList.size() > fieldIndex)) {
                            locRef = locRefList.get(fieldIndex);
                        } else {
                            break;
                        }
                    } else {
                        break;
View Full Code Here

    private static ConfigList expandSugarArray(ConfigValue fieldValue,
                                                 Class<?> elementType,
                                                 PluginRegistry pluginRegistry,
                                                 boolean nested) {
        ConfigList fieldList = (ConfigList) fieldValue;
        List<Object> newList = new ArrayList<>(fieldList.size());
        for (ConfigValue listEntry : fieldList) {
            ConfigValue listObject;
            if (nested) {
                listObject = expandSugarArray(listEntry, elementType, pluginRegistry, false);
            } else {
                listObject = expandSugar(elementType, listEntry, pluginRegistry);
            }
            newList.add(listObject.unwrapped());
        }
        return ConfigValueFactory.fromIterable(newList, fieldList.origin().description());
    }
View Full Code Here

                        } else {
                            break;
                        }
                    } else if (locRef instanceof ConfigList) {
                        int fieldIndex = path.getIndex();
                        ConfigList locRefList = (ConfigList) locRef;
                        if ((fieldIndex >= 0) && (locRefList.size() > fieldIndex)) {
                            locRef = locRefList.get(fieldIndex);
                        } else {
                            break;
                        }
                    } else {
                        break;
View Full Code Here

    builder.hostFilter(defaultHostFilter);
    return builder;
  }

  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");
      }
View Full Code Here

TOP

Related Classes of com.typesafe.config.ConfigList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.