@Test public void testMatches_recursiveInclusion() { final Path root= Paths.get("/my/root/"); final String[] includes= { "**/*.properties" }; final String[] excludes= { }; final FileMatcher fileMatcher= new FileMatcher(root, includes, excludes); assertThat(fileMatcher.matches(Paths.get("/my/root/my.properties"))).isTrue(); assertThat(fileMatcher.matches(Paths.get("/my/root/sub/my.properties"))).isTrue(); assertThat(fileMatcher.matches(Paths.get("/my/root/sub/sub/my.properties"))).isTrue(); }
public boolean matches(final Path path) { final Path canonicalPath= this.root.resolve(path).toAbsolutePath().normalize(); for (final MatchPattern matchPattern : this.i18nExcludePatterns) { if (matchPattern.matchPath(canonicalPath.toString(), true)) { return false; } } for (final MatchPattern matchPattern : this.i18nIncludePatterns) { if (matchPattern.matchPath(canonicalPath.toString(), true)) { return true; } } return false; }
FileMatcher { public boolean matches(final Path path) { final Path canonicalPath= this.root.resolve(path).toAbsolutePath().normalize(); for (final MatchPattern matchPattern : this.i18nExcludePatterns) { if (matchPattern.matchPath(canonicalPath.toString(), true)) { return false; } } for (final MatchPattern matchPattern : this.i18nIncludePatterns) { if (matchPattern.matchPath(canonicalPath.toString(), true)) { return true; } } return false; } }
FileMatcher { public boolean matches(final Path path) { final Path canonicalPath= this.root.resolve(path).toAbsolutePath().normalize(); for (final MatchPattern matchPattern : this.i18nExcludePatterns) { if (matchPattern.matchPath(canonicalPath.toString(), true)) { return false; } } for (final MatchPattern matchPattern : this.i18nIncludePatterns) { if (matchPattern.matchPath(canonicalPath.toString(), true)) { return true; } } return false; } FileMatcher(final Path root, final String[] i18nIncludes);  FileMatcher(final Path root, final List<String> i18nIncludes);  FileMatcher(final Path root, final String[] i18nIncludes, final String[] i18nExcludes);  FileMatcher(final Path root, final List<String> i18nIncludes, final List<String> i18nExcludes); }
FileMatcher { public boolean matches(final Path path) { final Path canonicalPath= this.root.resolve(path).toAbsolutePath().normalize(); for (final MatchPattern matchPattern : this.i18nExcludePatterns) { if (matchPattern.matchPath(canonicalPath.toString(), true)) { return false; } } for (final MatchPattern matchPattern : this.i18nIncludePatterns) { if (matchPattern.matchPath(canonicalPath.toString(), true)) { return true; } } return false; } FileMatcher(final Path root, final String[] i18nIncludes);  FileMatcher(final Path root, final List<String> i18nIncludes);  FileMatcher(final Path root, final String[] i18nIncludes, final String[] i18nExcludes);  FileMatcher(final Path root, final List<String> i18nIncludes, final List<String> i18nExcludes); boolean matches(final Path path); Set<File> findMatchingFiles(); Path getRoot(); List<String> getI18nIncludes(); List<String> getI18nExcludes(); }
FileMatcher { public boolean matches(final Path path) { final Path canonicalPath= this.root.resolve(path).toAbsolutePath().normalize(); for (final MatchPattern matchPattern : this.i18nExcludePatterns) { if (matchPattern.matchPath(canonicalPath.toString(), true)) { return false; } } for (final MatchPattern matchPattern : this.i18nIncludePatterns) { if (matchPattern.matchPath(canonicalPath.toString(), true)) { return true; } } return false; } FileMatcher(final Path root, final String[] i18nIncludes);  FileMatcher(final Path root, final List<String> i18nIncludes);  FileMatcher(final Path root, final String[] i18nIncludes, final String[] i18nExcludes);  FileMatcher(final Path root, final List<String> i18nIncludes, final List<String> i18nExcludes); boolean matches(final Path path); Set<File> findMatchingFiles(); Path getRoot(); List<String> getI18nIncludes(); List<String> getI18nExcludes();  }