/** * Check if any {@link ImporterFactory} supports importing the given * {@link InputFile}. * * @param file * the file for which to check if an importer exists. * @return <code>true</code> if an importer exists, else <code>false</code>. */ public boolean supportsFile(final InputFile file) { final boolean supported = !getMatchingFactories(file).isEmpty(); LOG.finest(() -> "File " + file + " is supported = " + supported); return supported; }
/** * Check if any {@link ImporterFactory} supports importing the given * {@link InputFile}. * * @param file * the file for which to check if an importer exists. * @return <code>true</code> if an importer exists, else <code>false</code>. */ public boolean supportsFile(final InputFile file) { final boolean supported = !getMatchingFactories(file).isEmpty(); LOG.finest(() -> "File " + file + " is supported = " + supported); return supported; }
/** * Finds a matching {@link ImporterFactory} that can handle the given * {@link Path}. If no or more than one {@link ImporterFactory} is found, * this throws an {@link ImporterException}. * * @param file * the file for which to get a {@link ImporterFactory}. * @return a matching {@link ImporterFactory} that can handle the given * {@link Path} * @throws ImporterException * when no or more than one {@link ImporterFactory} is found. */ public ImporterFactory getImporterFactory(final InputFile file) { final List<ImporterFactory> matchingImporters = getMatchingFactories(file); switch (matchingImporters.size()) { case 0: throw new ImporterException("Found no matching importer for file '" + file + "'"); case 1: return matchingImporters.get(0); default: throw new ImporterException( "Found more than one matching importer for file '" + file + "'"); } }
/** * Finds a matching {@link ImporterFactory} that can handle the given * {@link Path}. If no or more than one {@link ImporterFactory} is found, * this throws an {@link ImporterException}. * * @param file * the file for which to get a {@link ImporterFactory}. * @return a matching {@link ImporterFactory} that can handle the given * {@link Path} * @throws ImporterException * when no or more than one {@link ImporterFactory} is found. */ public ImporterFactory getImporterFactory(final InputFile file) { final List<ImporterFactory> matchingImporters = getMatchingFactories(file); switch (matchingImporters.size()) { case 0: throw new ImporterException("Found no matching importer for file '" + file + "'"); case 1: return matchingImporters.get(0); default: throw new ImporterException( "Found more than one matching importer for file '" + file + "'"); } }