Search in sources :

Example 1 with CompositeConfiguration

use of org.apache.commons.configuration2.CompositeConfiguration in project bitflyer4j by after-the-sunrise.

the class Bitflyer4jFactory method createConfiguration.

/**
 * Create a {@link Configuration} instance,
 * composed of multiple configurations which are enumerated in {@link ConfigurationType}.
 *
 * @return Composite configuration instance.
 */
@VisibleForTesting
AbstractConfiguration createConfiguration(Properties properties) {
    CompositeConfiguration composite = new CompositeConfiguration();
    ConfigurationType[] types = ConfigurationType.values();
    Arrays.stream(types).forEach(s -> s.get().ifPresent(composite::addConfiguration));
    Optional.ofNullable(properties).ifPresent(p -> composite.addConfiguration(new MapConfiguration(p)));
    return composite;
}
Also used : CompositeConfiguration(org.apache.commons.configuration2.CompositeConfiguration) MapConfiguration(org.apache.commons.configuration2.MapConfiguration) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 CompositeConfiguration (org.apache.commons.configuration2.CompositeConfiguration)1 MapConfiguration (org.apache.commons.configuration2.MapConfiguration)1