Package com.typesafe.config

Examples of com.typesafe.config.Config.root()


            }
        }
        Class vc = (Class) field.getGenericTypes()[1];
        boolean va = field.isMapValueArray();
        Config configMap = config.getConfig(field.getName());
        for (Map.Entry<String, ConfigValue> entry : configMap.root().entrySet()) {
            String key = entry.getKey();
            if (field.isInterned()) {
                key = key.intern();
            }
            // control for map keys that might have unexpected behavior when parsed as paths
View Full Code Here


            Object value = null;
            if (resolvedName.equals(primaryFieldName)) {
                if (unusedKeys.size() == 1) {
                    String onlyUnusedKey = unusedKeys.iterator().next();
                    ConfigObject onlyObject = resolvedConfig.root().withOnlyKey(onlyUnusedKey);
                    if (resolvedConfig.hasPath(primaryFieldName)) {
                        onlyObject = onlyObject.withFallback(
                                resolvedConfig.getValue(primaryFieldName).atKey(onlyUnusedKey));
                    }
                    CodableClassInfo primaryInfo = getOrCreateClassInfo(
View Full Code Here

            throws CodecExceptionLineNumber, JSONException {

        Config fieldDefaults = classInfo.getFieldDefaults();
        if (object instanceof JSONCodable) {
            try {
                for (String key : fieldDefaults.root().keySet()) {
                    if (!json.has(key)) {
                        json.put(key, JSONObject.wrap(fieldDefaults.root().get(key).unwrapped()));
                    }
                }
                ((JSONCodable) object).fromJSONObject(json);
View Full Code Here

        Config fieldDefaults = classInfo.getFieldDefaults();
        if (object instanceof JSONCodable) {
            try {
                for (String key : fieldDefaults.root().keySet()) {
                    if (!json.has(key)) {
                        json.put(key, JSONObject.wrap(fieldDefaults.root().get(key).unwrapped()));
                    }
                }
                ((JSONCodable) object).fromJSONObject(json);
            } catch (Exception ex) {
                throw new CodecExceptionLineNumber(ex, json.getLineNumberInfo());
View Full Code Here

            }
            String fieldName = field.getName();
            unknownFields.remove(fieldName);
            Class type = field.getTypeOrComponentType();
            Object value = json.opt(fieldName);
            if ((value == null) && fieldDefaults.root().containsKey(fieldName)) {
                value = CodecConfig.getDefault().hydrateField(field, fieldDefaults, object);
                if (value != null) {
                    field.setStrictJson(object, json.getLineNumberInfo(), value, json.getValLineNumber(fieldName));
                    continue;
                }
View Full Code Here

        this.config = config;
        Config defaultPluginMapSettings = config.getConfig(PLUGIN_DEFAULTS_PATH);
        String pluginPath = config.getString(PLUGINS_PATH_PATH);
        Config pluginConfigs = config.getConfig(pluginPath);

        Set<String> categories = pluginConfigs.root().keySet();
        Map<String, PluginMap> mapsFromConfig = new HashMap<>(categories.size());
        BiMap<Class<?>, PluginMap> mapsFromConfigByClass = HashBiMap.create(categories.size());
        for (String category : categories) {
            Config pluginConfig = pluginConfigs.getConfig(category)
                                               .withFallback(defaultPluginMapSettings);
View Full Code Here

            throws CodecExceptionLineNumber, JSONException {

        Config fieldDefaults = classInfo.getFieldDefaults();
        if (object instanceof JSONCodable) {
            try {
                for (String key : fieldDefaults.root().keySet()) {
                    if (!json.has(key)) {
                        json.put(key, JSONObject.wrap(fieldDefaults.root().get(key).unwrapped()));
                    }
                }
                ((JSONCodable) object).fromJSONObject(json);
View Full Code Here

        Config fieldDefaults = classInfo.getFieldDefaults();
        if (object instanceof JSONCodable) {
            try {
                for (String key : fieldDefaults.root().keySet()) {
                    if (!json.has(key)) {
                        json.put(key, JSONObject.wrap(fieldDefaults.root().get(key).unwrapped()));
                    }
                }
                ((JSONCodable) object).fromJSONObject(json);
            } catch (Exception ex) {
                throw new CodecExceptionLineNumber(ex, json.getLineNumberInfo());
View Full Code Here

            }
            String fieldName = field.getName();
            unknownFields.remove(fieldName);
            Class type = field.getType();
            Object value = json.opt(fieldName);
            if ((value == null) && fieldDefaults.root().containsKey(fieldName)) {
                value = CodecConfig.getDefault().hydrateField(field, fieldDefaults);
                if (value != null) {
                    field.set(object, json.getLineNumberInfo(), value, json.getValLineNumber(fieldName));
                    continue;
                }
View Full Code Here

    public PluginRegistry(Config config) {
        Config defaultPluginMapSettings = config.getConfig(PLUGIN_DEFAULTS_PATH);
        String pluginPath = config.getString(PLUGINS_PATH_PATH);
        Config pluginConfigs = config.getConfig(pluginPath);

        Set<String> categories = pluginConfigs.root().keySet();
        Map<String, PluginMap> pluginsFromConfig = new HashMap<>(categories.size());
        for (String category : categories) {
            Config pluginConfig = pluginConfigs.getConfig(category)
                                               .withFallback(defaultPluginMapSettings);
            PluginMap pluginMap = new PluginMap(category, pluginConfig);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.