Example usage for org.apache.commons.configuration.builder FileBasedBuilderParametersImpl FileBasedBuilderParametersImpl

List of usage examples for org.apache.commons.configuration.builder FileBasedBuilderParametersImpl FileBasedBuilderParametersImpl

Introduction

In this page you can find the example usage for org.apache.commons.configuration.builder FileBasedBuilderParametersImpl FileBasedBuilderParametersImpl.

Prototype

public FileBasedBuilderParametersImpl() 

Source Link

Document

Creates a new instance of FileBasedBuilderParametersImpl with an uninitialized FileHandler object.

Usage

From source file:ubic.basecode.util.ConfigUtils.java

/**
 * @param file/*from   w w w .java2  s.com*/
 * @return
 */
public static FileBasedConfigurationBuilder<PropertiesConfiguration> getConfigBuilder(File file)
        throws ConfigurationException {
    if (!file.exists()) {
        try {
            FileTools.touch(file);
        } catch (IOException e) {
            throw new ConfigurationException("Couldn't create the file: " + e.getMessage());
        }
    }
    FileBasedConfigurationBuilder<PropertiesConfiguration> builder = new FileBasedConfigurationBuilder<PropertiesConfiguration>(
            PropertiesConfiguration.class);
    builder.configure(new FileBasedBuilderParametersImpl().setFile(file));
    return builder;
}