protected Spec<FileTreeElement> createSpec(Collection<String> patterns, boolean include, boolean caseSensitive) { if (patterns.isEmpty()) { return include ? Specs.<FileTreeElement>satisfyAll() : Specs.<FileTreeElement>satisfyNone(); } List<Spec<RelativePath>> matchers = new ArrayList<Spec<RelativePath>>(patterns.size()); for (String pattern : patterns) { Spec<RelativePath> patternMatcher = PatternMatcherFactory.getPatternMatcher(include, caseSensitive, pattern); matchers.add(patternMatcher); } return new RelativePathSpec(Specs.union(matchers)); }
public CopySpec filesMatching(Iterable<String> patterns, Action<? super FileCopyDetails> action) { if (!patterns.iterator().hasNext()) { throw new InvalidUserDataException("must provide at least one pattern to match"); } List<Spec> matchers = new ArrayList<Spec>(); for (String pattern : patterns) { matchers.add(PatternMatcherFactory.getPatternMatcher(true, isCaseSensitive(), pattern)); } Spec unionMatcher = Specs.union(matchers.toArray(new Spec[matchers.size()])); return eachFile(new MatchingCopyAction(unionMatcher, action)); }
public CopySpec filesNotMatching(Iterable<String> patterns, Action<? super FileCopyDetails> action) { if (!patterns.iterator().hasNext()) { throw new InvalidUserDataException("must provide at least one pattern to not match"); } List<Spec> matchers = new ArrayList<Spec>(); for (String pattern : patterns) { matchers.add(PatternMatcherFactory.getPatternMatcher(true, isCaseSensitive(), pattern)); } Spec unionMatcher = Specs.union(matchers.toArray(new Spec[matchers.size()])); return eachFile(new MatchingCopyAction(Specs.<RelativePath>negate(unionMatcher), action)); }
private Spec<RelativePath> getAsExcludeSpec(boolean caseSensitive) { Collection<String> allExcludes = new LinkedHashSet<String>(myFilePattern.excludes); List<Spec<RelativePath>> matchers = new ArrayList<Spec<RelativePath>>(); for (String exclude : allExcludes) { Spec<RelativePath> patternMatcher = PatternMatcherFactory.getPatternMatcher(false, caseSensitive, exclude); matchers.add(patternMatcher); } return Specs.or(false, matchers); }
private Spec<RelativePath> getAsIncludeSpec(boolean caseSensitive) { List<Spec<RelativePath>> matchers = new ArrayList<Spec<RelativePath>>(); for (String include : myFilePattern.includes) { Spec<RelativePath> patternMatcher = PatternMatcherFactory.getPatternMatcher(true, caseSensitive, include); matchers.add(patternMatcher); } return Specs.or(true, matchers); }
public Spec<FileTreeElement> getAsIncludeSpec() { List<Spec<FileTreeElement>> matchers = Lists.newArrayList(); for (String include : includes) { Spec<RelativePath> patternMatcher = PatternMatcherFactory.getPatternMatcher(true, caseSensitive, include); matchers.add(new RelativePathSpec(patternMatcher)); } matchers.addAll(includeSpecs); return new OrSpec<FileTreeElement>(matchers); }
public Spec<FileTreeElement> getAsExcludeSpec() { Collection<String> allExcludes = Sets.newLinkedHashSet(excludes); Collections.addAll(allExcludes, DirectoryScanner.getDefaultExcludes()); List<Spec<FileTreeElement>> matchers = Lists.newArrayList(); for (String exclude : allExcludes) { Spec<RelativePath> patternMatcher = PatternMatcherFactory.getPatternMatcher(false, caseSensitive, exclude); matchers.add(new RelativePathSpec(patternMatcher)); } matchers.addAll(excludeSpecs); return new OrSpec<FileTreeElement>(matchers); }
public CopySpec filesMatching(String pattern, Action<? super FileCopyDetails> action) { Spec<RelativePath> matcher = PatternMatcherFactory.getPatternMatcher(true, isCaseSensitive(), pattern); return eachFile(new MatchingCopyAction(matcher, action)); }
public CopySpec filesNotMatching(String pattern, Action<? super FileCopyDetails> action) { Spec<RelativePath> matcher = PatternMatcherFactory.getPatternMatcher(true, isCaseSensitive(), pattern); return eachFile(new MatchingCopyAction(Specs.<RelativePath>negate(matcher), action)); }
public CopySpec filesMatching(String pattern, Action<? super FileCopyDetails> action) { Spec<RelativePath> matcher = PatternMatcherFactory.getPatternMatcher(true, isCaseSensitive(), pattern); return eachFile( new MatchingCopyAction(matcher, action)); }
public CopySpec filesNotMatching(String pattern, Action<? super FileCopyDetails> action) { Spec<RelativePath> matcher = PatternMatcherFactory.getPatternMatcher(true, isCaseSensitive(), pattern); return eachFile( new MatchingCopyAction(new NotSpec<RelativePath>(matcher), action)); }