Exemplo n.º 1
0
  public Set<String> getKeys(boolean deep) {
    Set<String> result = new LinkedHashSet<String>();

    if (getRoot().options().copyDefaults()) {
      ConfigurationSection defaults = getDefaultSection();

      if (defaults != null) {
        result.addAll(defaults.getKeys(deep));
      }
    }

    mapChildrenKeys(result, this, deep);

    return result;
  }
Exemplo n.º 2
0
  protected void mapChildrenKeys(Set<String> output, ConfigurationSection section, boolean deep) {
    if (section instanceof MemorySection) {
      MemorySection sec = (MemorySection) section;

      for (Map.Entry<String, Object> entry : sec.map.entrySet()) {
        output.add(createPath(section, entry.getKey(), this));

        if ((deep) && (entry.getValue() instanceof ConfigurationSection)) {
          ConfigurationSection subsection = (ConfigurationSection) entry.getValue();
          mapChildrenKeys(output, subsection, deep);
        }
      }
    } else {
      Set<String> keys = section.getKeys(deep);

      for (String key : keys) {
        output.add(createPath(section, key, this));
      }
    }
  }