@Test public void testMatches() { assertThat(FileNameUtil.matches("a/b/c/d/e.txt", "ae.txt"), is(true)); assertThat(FileNameUtil.matches("a/b/c/d/e.txt", "ae.txt"), is(true)); assertThat(FileNameUtil.matches("a/b/c/d/e.txt", "*/e.txt"), is(false)); assertThat(FileNameUtil.matches("a/b/c/d/e.txt", Lists.newArrayList("**/e.txt"), false), is(true)); assertThat(FileNameUtil.matches("a/b/c/d/e.txt", Lists.newArrayList("*/e.txt"), true), is(false)); assertThat(FileNameUtil.matches("a/b/c/d/e.txt", null, false), is(false)); assertThat(FileNameUtil.matches("a/b/c/d/e.txt", null, true), is(true)); }
public static boolean matches(String name, List<String> patterns, boolean defaultValue) { if (patterns == null || patterns.isEmpty()) { return defaultValue; } return patterns.stream() .anyMatch(pattern -> matches(name, pattern)); }
FileNameUtil { public static boolean matches(String name, List<String> patterns, boolean defaultValue) { if (patterns == null || patterns.isEmpty()) { return defaultValue; } return patterns.stream() .anyMatch(pattern -> matches(name, pattern)); } }
FileNameUtil { public static boolean matches(String name, List<String> patterns, boolean defaultValue) { if (patterns == null || patterns.isEmpty()) { return defaultValue; } return patterns.stream() .anyMatch(pattern -> matches(name, pattern)); } private  FileNameUtil(); }
FileNameUtil { public static boolean matches(String name, List<String> patterns, boolean defaultValue) { if (patterns == null || patterns.isEmpty()) { return defaultValue; } return patterns.stream() .anyMatch(pattern -> matches(name, pattern)); } private  FileNameUtil(); static List<File> identifyFiles(Map parameters); static boolean isIncluded(String name, Map parameters); static boolean matches(String name, List<String> patterns, boolean defaultValue); static boolean matches(String name, String pattern); static String getParentPath(String fileName); static String getCanonicalPath(String path); }
FileNameUtil { public static boolean matches(String name, List<String> patterns, boolean defaultValue) { if (patterns == null || patterns.isEmpty()) { return defaultValue; } return patterns.stream() .anyMatch(pattern -> matches(name, pattern)); } private  FileNameUtil(); static List<File> identifyFiles(Map parameters); static boolean isIncluded(String name, Map parameters); static boolean matches(String name, List<String> patterns, boolean defaultValue); static boolean matches(String name, String pattern); static String getParentPath(String fileName); static String getCanonicalPath(String path);  }