@Test public void testToFile() throws Exception { assertFalse(loader.toFile(new URI("file: assertTrue(loader.toFile(new URI(configFileUriString)).isPresent()); final URI fileUri = new URI("classpath: .replace('.', '/')); assertTrue(loader.toFile(fileUri).isPresent()); }
@Override public Optional<File> toFile(final URI fileUri) { final Optional<URL> urlOptional = loadResources(fileUri); if (urlOptional.isPresent() && urlOptional.get().getProtocol().equalsIgnoreCase(FileConfigFileLoader.PREFIX)) { try { return Optional.of(new File(urlOptional.get().toURI())); } catch (URISyntaxException e) { return Optional.empty(); } } return Optional.empty(); }
ClasspathConfigFileLoader implements ConfigFileLoaderPlugin { @Override public Optional<File> toFile(final URI fileUri) { final Optional<URL> urlOptional = loadResources(fileUri); if (urlOptional.isPresent() && urlOptional.get().getProtocol().equalsIgnoreCase(FileConfigFileLoader.PREFIX)) { try { return Optional.of(new File(urlOptional.get().toURI())); } catch (URISyntaxException e) { return Optional.empty(); } } return Optional.empty(); } }
ClasspathConfigFileLoader implements ConfigFileLoaderPlugin { @Override public Optional<File> toFile(final URI fileUri) { final Optional<URL> urlOptional = loadResources(fileUri); if (urlOptional.isPresent() && urlOptional.get().getProtocol().equalsIgnoreCase(FileConfigFileLoader.PREFIX)) { try { return Optional.of(new File(urlOptional.get().toURI())); } catch (URISyntaxException e) { return Optional.empty(); } } return Optional.empty(); }  }
ClasspathConfigFileLoader implements ConfigFileLoaderPlugin { @Override public Optional<File> toFile(final URI fileUri) { final Optional<URL> urlOptional = loadResources(fileUri); if (urlOptional.isPresent() && urlOptional.get().getProtocol().equalsIgnoreCase(FileConfigFileLoader.PREFIX)) { try { return Optional.of(new File(urlOptional.get().toURI())); } catch (URISyntaxException e) { return Optional.empty(); } } return Optional.empty(); }  @Override Optional<File> toFile(final URI fileUri); @Override String getUriScheme(); @Override Optional<Long> lastModified(final URI fileURI); @Override boolean isAccessible(final URI fileURI); @Override byte[] loadFile(final URI fileURI); @Override boolean isAccessible(final URI configFileUri, final String pathToSubResource); @Override byte[] loadFile(final URI configFileUri, final String pathToSubResource); }
ClasspathConfigFileLoader implements ConfigFileLoaderPlugin { @Override public Optional<File> toFile(final URI fileUri) { final Optional<URL> urlOptional = loadResources(fileUri); if (urlOptional.isPresent() && urlOptional.get().getProtocol().equalsIgnoreCase(FileConfigFileLoader.PREFIX)) { try { return Optional.of(new File(urlOptional.get().toURI())); } catch (URISyntaxException e) { return Optional.empty(); } } return Optional.empty(); }  @Override Optional<File> toFile(final URI fileUri); @Override String getUriScheme(); @Override Optional<Long> lastModified(final URI fileURI); @Override boolean isAccessible(final URI fileURI); @Override byte[] loadFile(final URI fileURI); @Override boolean isAccessible(final URI configFileUri, final String pathToSubResource); @Override byte[] loadFile(final URI configFileUri, final String pathToSubResource); static final String PREFIX; static final int PREFIX_LENGTH; }