Пример #1
0
 /** Optional suffix appended to property names before resolution. */
 public void setPropertySuffix(String propertySuffix) {
   this.propertySuffix = propertySuffix;
   this.propertySuffixResolved = propertySuffix;
   if (ObjectHelper.isNotEmpty(this.propertySuffix)) {
     this.propertySuffixResolved = FilePathResolver.resolvePath(this.propertySuffix);
   }
 }
Пример #2
0
  private List<PropertiesLocation> parseLocations(List<PropertiesLocation> locations) {
    List<PropertiesLocation> answer = new ArrayList<>();

    for (PropertiesLocation location : locations) {
      LOG.trace("Parsing location: {} ", location);

      try {
        String path = FilePathResolver.resolvePath(location.getPath());
        LOG.debug("Parsed location: {} ", path);
        if (ObjectHelper.isNotEmpty(path)) {
          answer.add(new PropertiesLocation(location.getResolver(), path, location.isOptional()));
        }
      } catch (IllegalArgumentException e) {
        if (!ignoreMissingLocation && !location.isOptional()) {
          throw e;
        } else {
          LOG.debug("Ignored missing location: {}", location);
        }
      }
    }

    // must return a not-null answer
    return answer;
  }
Пример #3
0
  private String[] parseLocations(String[] locations) {
    List<String> answer = new ArrayList<String>();

    for (String location : locations) {
      LOG.trace("Parsing location: {} ", location);

      try {
        location = FilePathResolver.resolvePath(location);
        LOG.debug("Parsed location: {} ", location);
        if (ObjectHelper.isNotEmpty(location)) {
          answer.add(location);
        }
      } catch (IllegalArgumentException e) {
        if (!ignoreMissingLocation) {
          throw e;
        } else {
          LOG.debug("Ignored missing location: {}", location);
        }
      }
    }

    // must return a not-null answer
    return answer.toArray(new String[answer.size()]);
  }