Пример #1
0
 private static void findPaths(
     Set<Map.Entry<String, ConfigValue>> entries, Path parent, AbstractConfigObject obj) {
   for (Map.Entry<String, ConfigValue> entry : obj.entrySet()) {
     String elem = entry.getKey();
     ConfigValue v = entry.getValue();
     Path path = Path.newKey(elem);
     if (parent != null) path = path.prepend(parent);
     if (v instanceof AbstractConfigObject) {
       findPaths(entries, path, (AbstractConfigObject) v);
     } else if (v instanceof ConfigNull) {
       // nothing; nulls are conceptually not in a Config
     } else {
       entries.add(new AbstractMap.SimpleImmutableEntry<String, ConfigValue>(path.render(), v));
     }
   }
 }
Пример #2
0
  // path is null if we're at the root
  private static void checkValidObject(
      Path path,
      AbstractConfigObject reference,
      AbstractConfigObject value,
      List<ConfigException.ValidationProblem> accumulator) {
    for (Map.Entry<String, ConfigValue> entry : reference.entrySet()) {
      String key = entry.getKey();

      Path childPath;
      if (path != null) childPath = Path.newKey(key).prepend(path);
      else childPath = Path.newKey(key);

      AbstractConfigValue v = value.get(key);
      if (v == null) {
        addMissing(accumulator, entry.getValue(), childPath, value.origin());
      } else {
        checkValid(childPath, entry.getValue(), v, accumulator);
      }
    }
  }