Java 类org.apache.commons.configuration2.tree.OverrideCombiner 实例源码

项目:beadledom    文件:BeadledomConfigurationModule.java   
@Provides
@Singleton
ImmutableHierarchicalConfiguration providesConfiguration(
    Set<ConfigurationSource> configurationSources) {
  CombinedConfiguration config = new CombinedConfiguration();

  List<ConfigurationSource> sortedConfigurations = new ArrayList<ConfigurationSource>();
  sortedConfigurations.addAll(configurationSources);
  Collections.sort(sortedConfigurations);

  ConfigurationSource previousConfigSource = null;
  for (ConfigurationSource configSource : sortedConfigurations) {
    if (previousConfigSource != null) {
      warnIfEqualPriority(previousConfigSource, configSource);
    }
    config.addConfiguration(configSource.getConfig());
    previousConfigSource = configSource;
  }
  config.setNodeCombiner(new OverrideCombiner());
  return config;
}