Package com.typesafe.config

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


    final Config config = root.getConfig("form-field-bundle");

    final Map<String, String> props = new HashMap<String, String>();

    final Set<String> keySet = config.root().keySet();

    for (final String configId : keySet) {

      final Config configField = config.getConfig(configId);
View Full Code Here


      System.err.println("Usage: java -cp ... " + PrettyPrinter.class.getName() + " <morphlineConfigFile>");
      return;
    }
   
    Config config = ConfigFactory.parseFile(new File(args[0]));
    String str = config.root().render(
        ConfigRenderOptions.concise().setFormatted(true).setJson(false).setComments(true));

    System.out.println(str);
  }
 
View Full Code Here

      System.err.println("Usage: java -cp ... " + PrettyPrinter.class.getName() + " <morphlineConfigFile>");
      return;
    }
   
    Config config = ConfigFactory.parseFile(new File(args[0]));
    String str = config.root().render(
        ConfigRenderOptions.concise().setFormatted(true).setJson(false).setComments(true));

    System.out.println(str);
  }
 
View Full Code Here

                                               "failed to get a concrete, working class", ex);
        }
        Class vc = (Class) field.getGenericTypes()[1];
        boolean va = field.isMapValueArray();
        Config configMap = config.getConfig(field.getName());
        for (String key : configMap.root().keySet()) {
            if (field.isInterned()) {
                key = key.intern();
            }
            if (va) {
                map.put(key, hydrateArray(vc, key, configMap));
View Full Code Here

    final Config config = root.getConfig("form-field-bundle");

    final Map<String, String> props = new HashMap<String, String>();

    final Set<String> keySet = config.root().keySet();

    for (final String configId : keySet) {

      final Config configField = config.getConfig(configId);
View Full Code Here

     */
    public <T> T decodeObject(@Nonnull String category, @Syntax("HOCON") @Nonnull String configText) {
        PluginMap pluginMap = Preconditions.checkNotNull(pluginRegistry.asMap().get(category),
                                                         "could not find anything about the category %s", category);
        Config config = ConfigFactory.parseString(configText).resolve();
        return hydrateObject(null, pluginMap, null, config.root());
    }

    /**
     * Instantiate an object without a compile time expected type. This expects a config of the
     * form "{plugin-category: {...}}". ie. there should be exactly one top level key and that
View Full Code Here

                if (ValueCodable.class.isAssignableFrom(type)) {
                    try {
                        T objectShell = type.newInstance();
                        CodableClassInfo configInfo = (info != null) ? info : getOrCreateClassInfo(type);
                        Config fieldDefaults = configInfo.getFieldDefaults();
                        ((ValueCodable) objectShell).fromConfigValue(configValue, fieldDefaults.root());
                        if (objectShell instanceof SuperCodable) {
                            ((SuperCodable) objectShell).postDecode();
                        }
                        return objectShell;
                    } catch (InstantiationException | IllegalAccessException | RuntimeException ex) {
View Full Code Here

            }
        }
        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

                                               "failed to get a concrete, working class", ex);
        }
        Class vc = (Class) field.getGenericTypes()[1];
        boolean va = field.isMapValueArray();
        Config configMap = config.getConfig(field.getName());
        for (String key : configMap.root().keySet()) {
            if (field.isInterned()) {
                key = key.intern();
            }
            if (va) {
                map.put(key, hydrateArray(vc, key, configMap));
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.