/**
  * set property locations
  *
  * @param propertyLocations lists of property locations which can be Strings: use as Directory
  *     Classes: use as Class Resource Location
  * @return the instance of ConfigBuilder
  */
 public ConfigBuilder<T> withPropertyLocations(Object... propertyLocations) {
   final DefaultPropertyLocationContainer locations = propertyLoader.getLocations();
   locations.clear();
   for (Object propertyLocation : propertyLocations) {
     if (propertyLocation instanceof String) {
       locations.atDirectory((String) propertyLocation);
     } else if (propertyLocation instanceof Class) {
       locations.atRelativeToClass((Class) propertyLocation);
     } else if (propertyLocation == AT_CONTEXT_CLASS_PATH) {
       locations.atContextClassPath();
     } else {
       LOGGER.warn("unhandled property location '{}'", propertyLocation);
     }
   }
   return this;
 }
  /**
   * set property filters in use
   *
   * @param propertyFilters property filters which should be applied after loading properties
   * @return the instance of ConfigBuilder
   */
  public ConfigBuilder<T> withPropertyFilters(
      Class<? extends PropertyLoaderFilter>... propertyFilters) {
    final DefaultPropertyFilterContainer filterContainer = propertyLoader.getFilters();
    final List<PropertyLoaderFilter> filters = filterContainer.getFilters();
    filters.clear();

    for (Class<? extends PropertyLoaderFilter> propertyFilter : propertyFilters) {
      try {
        filters.add(propertyFilter.newInstance());
      } catch (InstantiationException e) {
        LOGGER.error("could not create filter '{}'", propertyFilter.getSimpleName(), e);
      } catch (IllegalAccessException e) {
        LOGGER.error("could not create filter '{}'", propertyFilter.getSimpleName(), e);
      }
    }
    return this;
  }
  private void setupBuilderConfiguration(PropertyLoader propertyLoader) {
    if (configClass.isAnnotationPresent(LoadingOrder.class)) {
      builderConfiguration.setAnnotationOrder(
          configClass.getAnnotation(LoadingOrder.class).value());
    }

    if (configClass.isAnnotationPresent(PropertyNamePrefix.class)) {
      builderConfiguration.setPropertyNamePrefixes(
          configClass.getAnnotation(PropertyNamePrefix.class).value());
    }

    final Properties properties = propertyLoader.load();
    properties.putAll(additionalProperties);
    builderConfiguration.setProperties(properties);

    builderConfiguration.setCommandLine(
        commandLineHelper.getCommandLine(configClass, commandLineArgs));
  }
 /**
  * set file names of property files to read
  *
  * @param fileNames one or more property file names
  * @return the instance of ConfigBuilder
  */
 public ConfigBuilder<T> withPropertiesFiles(String... fileNames) {
   propertyLoader.withBaseNames(Arrays.asList(fileNames));
   return this;
 }
 /**
  * add more property file suffixes to the list of possible property suffixes
  *
  * @param suffixArray one or more property file name suffix
  * @return the instance of ConfigBuilder
  */
 public ConfigBuilder<T> addPropertySuffixes(String... suffixArray) {
   propertyLoader.getSuffixes().addSuffixList(Arrays.asList(suffixArray));
   return this;
 }
 /**
  * replace list of possible property suffixes by given elements
  *
  * @param suffixArray one or more property file name suffix
  * @return the instance of ConfigBuilder
  */
 public ConfigBuilder<T> withPropertySuffixes(String... suffixArray) {
   final DefaultPropertySuffixContainer suffixes = propertyLoader.getSuffixes();
   suffixes.clear();
   suffixes.addSuffixList(Arrays.asList(suffixArray));
   return this;
 }
 /**
  * set the extension to search for property files
  *
  * @param propertyExtension property file name extension to use
  * @return the instance of ConfigBuilder
  */
 public ConfigBuilder<T> withPropertyExtension(String propertyExtension) {
   propertyLoader.withExtension(propertyExtension);
   return this;
 }
 /**
  * Configures the Config Builder to load given properties files instead of those specified in the
  * config class.
  *
  * @param baseNames
  * @return the instance of ConfigBuilder
  */
 public ConfigBuilder<T> overridePropertiesFiles(List<String> baseNames) {
   propertyLoader.withBaseNames(baseNames);
   return this;
 }