private boolean supportsConfiguredFile(final InputFile path) { return findConfig(path).isPresent(); }
@Override public boolean supportsFile(final InputFile path) { return supportsDefaultFile(path) || supportsConfiguredFile(path); }
@Override public Importer createImporter(final InputFile path, final ImportEventListener listener) { if (!supportsFile(path)) { throw new ImporterException("File '" + path + "' cannot be imported because it does not match any supported file patterns: " + DEFAULT_FILE_REGEX + " and " + getPathConfigs().collect(toList())); } final Optional<PathConfig> config = findConfig(path); return TagImporter.create(config, path, listener); }
private Stream<PathConfig> getPathConfigs() { final ImportSettings settings = getContext().getImportSettings(); return settings == null ? Stream.empty() : settings.getPathConfigs().stream(); } }
private Optional<PathConfig> findConfig(final InputFile file) { return getPathConfigs() // .filter(config -> config.matches(file)) // .findFirst(); }
@Override public Importer createImporter(final InputFile path, final ImportEventListener listener) { if (!supportsFile(path)) { throw new ImporterException("File '" + path + "' cannot be imported because it does not match any supported file patterns: " + DEFAULT_FILE_REGEX + " and " + getPathConfigs().collect(toList())); } final Optional<PathConfig> config = findConfig(path); return TagImporter.create(config, path, listener); }
private Stream<PathConfig> getPathConfigs() { final ImportSettings settings = getContext().getImportSettings(); return settings == null ? Stream.empty() : settings.getPathConfigs().stream(); } }
private Optional<PathConfig> findConfig(final InputFile file) { return getPathConfigs() // .filter(config -> config.matches(file)) // .findFirst(); }
@Override public boolean supportsFile(final InputFile path) { return supportsDefaultFile(path) || supportsConfiguredFile(path); }
private boolean supportsConfiguredFile(final InputFile path) { return findConfig(path).isPresent(); }