Java 类org.apache.commons.configuration2.ConfigurationUtils 实例源码

项目:sponge    文件:SpongeUtils.java   
/**
 * Dumps configuration to string.
 *
 * @param configuration a configuration.
 * @return a configuration dump string.
 */
public static String dumpConfiguration(org.apache.commons.configuration2.Configuration configuration) {
    StringWriter sw = new StringWriter();
    ConfigurationUtils.dump(configuration, new PrintWriter(sw));

    return sw.toString();
}
项目:spoofax    文件:AConfigBuilder.java   
protected HierarchicalConfiguration<ImmutableNode> cloneConfiguration(IConfig config) {
    // Clone configuration.
    final IConfig iconfig = (IConfig) config;
    final HierarchicalConfiguration<ImmutableNode> apacheConfig = iconfig.getConfig();
    final Configuration clonedConfig = ConfigurationUtils.cloneConfiguration(apacheConfig);
    @SuppressWarnings("unchecked") final HierarchicalConfiguration<ImmutableNode> clonedHierachicalConfig =
            (HierarchicalConfiguration<ImmutableNode>) clonedConfig;
    return clonedHierachicalConfig;
}
项目:yadaframework    文件:YadaConfiguration.java   
public void setBuilder(ReloadingCombinedConfigurationBuilder builder) throws ConfigurationException {
    this.builder = builder;
    this.configuration = ConfigurationUtils.unmodifiableConfiguration(builder.getConfiguration());
}
项目:yadaframework    文件:YadaConfiguration.java   
/**
 * Call this method to trigger a configuration reload, but only if the file has changed and the timeout since last reload has passed
 * @throws ConfigurationException 
 */
public void reloadIfNeeded() throws ConfigurationException {
    // TODO Doesn't seem to work
    builder.getReloadingController().checkForReloading(null);
    this.configuration = ConfigurationUtils.unmodifiableConfiguration(builder.getConfiguration());
}