List of usage examples for org.apache.commons.configuration.tree ConfigurationNode setName
void setName(String name);
From source file:com.github.mbredel.commons.configuration.YAMLConfiguration.java
@Override @SuppressWarnings("unchecked") public void load(Reader in) throws ConfigurationException { try {/*from w ww. j a va 2 s . c o m*/ Yaml yaml = new Yaml(); Map<String, Object> map = (Map) yaml.load(in); // Construct the configuration tree. ConfigurationNode configurationNode = getRootNode(); configurationNode.setName(DEFAULT_ROOT_NAME); constructHierarchy(configurationNode, map); } catch (ClassCastException e) { throw new ConfigurationException("Error parsing", e); } catch (Exception e) { this.getLogger().debug("Unable to load the configuration", e); throw new ConfigurationException("Unable to load the configuration", e); } }
From source file:com.github.mbredel.commons.configuration.YAMLConfiguration.java
/** * Loads the configuration from the given input stream. * * @param in the input stream//from www .j a va 2s .c om * @throws ConfigurationException if an error occurs */ @Override @SuppressWarnings("unchecked") public void load(InputStream in) throws ConfigurationException { try { Yaml yaml = new Yaml(); Map<String, Object> map = (Map) yaml.load(in); // Construct the configuration tree. ConfigurationNode configurationNode = getRootNode(); configurationNode.setName(DEFAULT_ROOT_NAME); constructHierarchy(configurationNode, map); } catch (ClassCastException e) { throw new ConfigurationException("Error parsing", e); } catch (Exception e) { this.getLogger().debug("Unable to load the configuration", e); throw new ConfigurationException("Unable to load the configuration", e); } }