/** * Creates a deep clone of this instance, except for the nested * selectors (the list of selectors is a shallow clone of this * instance's list). * @return the cloned object * @since Ant 1.6 */ @Override public synchronized Object clone() { if (isReference()) { return (getRef(getProject())).clone(); } try { AbstractFileSet fs = (AbstractFileSet) super.clone(); fs.defaultPatterns = (PatternSet) defaultPatterns.clone(); fs.additionalPatterns = additionalPatterns.stream().map(PatternSet::clone) .map(PatternSet.class::cast).collect(Collectors.toList()); fs.selectors = new ArrayList<>(selectors); return fs; } catch (CloneNotSupportedException e) { throw new BuildException(e); } }
/** * Returns included files as a list of semicolon-separated filenames. * * @return a <code>String</code> of included filenames. */ @Override public String toString() { if (isReference()) { return getRef(getProject()).toString(); } dieOnCircularReference(); DirectoryScanner ds = getDirectoryScanner(getProject()); return Stream.of(ds.getIncludedFiles()).collect(Collectors.joining(";")); }
/** * Returns the set of selectors as an array. * @param p the current project * @return a <code>FileSelector[]</code> of the selectors in this container. */ @Override public synchronized FileSelector[] getSelectors(Project p) { if (isReference()) { return getRef(getProject()).getSelectors(p); } dieOnCircularReference(p); return selectors.toArray(new FileSelector[selectors.size()]); }
/** * Returns an enumerator for accessing the set of selectors. * * @return an <code>Enumeration</code> of selectors. */ @Override public synchronized Enumeration<FileSelector> selectorElements() { if (isReference()) { return getRef(getProject()).selectorElements(); } dieOnCircularReference(); return Collections.enumeration(selectors); }
/** * Retrieves the base-directory for this instance. * @param p the <code>Project</code> against which the * reference is resolved, if set. * @return <code>File</code>. */ public synchronized File getDir(Project p) { if (isReference()) { return getRef(p).getDir(p); } dieOnCircularReference(); return dir; }
/** * Indicates whether there are any selectors here. * * @return whether any selectors are in this container. */ @Override public synchronized boolean hasSelectors() { if (isReference()) { return getRef(getProject()).hasSelectors(); } dieOnCircularReference(); return !selectors.isEmpty(); }
/** * Gives the count of the number of selectors in this container. * * @return the number of selectors in this container as an <code>int</code>. */ @Override public synchronized int selectorCount() { if (isReference()) { return getRef(getProject()).selectorCount(); } dieOnCircularReference(); return selectors.size(); }
/** * Whether default exclusions should be used or not. * @return the default exclusions value. * @since Ant 1.6.3 */ public synchronized boolean getDefaultexcludes() { if (isReference()) { return getRef(getProject()).getDefaultexcludes(); } dieOnCircularReference(); return useDefaultExcludes; }
/** * Find out if the fileset wants to follow symbolic links. * * @return <code>boolean</code> indicating whether symbolic links * should be followed. * * @since Ant 1.6 */ public synchronized boolean isFollowSymlinks() { if (isReference()) { return getRef(getProject()).isCaseSensitive(); } dieOnCircularReference(); return followSymlinks; }
/** * Get the merged patterns for this AbstractFileSet. * @param p the project to use. * @return the default patternset merged with the additional sets * in a new PatternSet instance. * * @since Ant 1.7 */ public synchronized PatternSet mergePatterns(Project p) { if (isReference()) { return getRef(p).mergePatterns(p); } dieOnCircularReference(); PatternSet ps = (PatternSet) defaultPatterns.clone(); additionalPatterns.forEach(pat -> ps.append(pat, p)); return ps; }
/** * Find out if the fileset is case sensitive. * * @return <code>boolean</code> indicating whether the fileset is * case sensitive. * * @since Ant 1.7 */ public synchronized boolean isCaseSensitive() { if (isReference()) { return getRef(getProject()).isCaseSensitive(); } dieOnCircularReference(); return caseSensitive; }
/** * Indicates whether there are any patterns here. * * @return whether any patterns are in this container. */ public synchronized boolean hasPatterns() { if (isReference() && getProject() != null) { return getRef(getProject()).hasPatterns(); } dieOnCircularReference(); return defaultPatterns.hasPatterns(getProject()) || additionalPatterns.stream().anyMatch(ps -> ps.hasPatterns(getProject())); }
return getRef(p).getDirectoryScanner(p);
/** * Set up the specified directory scanner against the specified project. * @param ds a <code>FileScanner</code> instance. * @param p an Ant <code>Project</code> instance. */ public synchronized void setupDirectoryScanner(FileScanner ds, Project p) { if (isReference()) { getRef(p).setupDirectoryScanner(ds, p); return; } dieOnCircularReference(p); if (ds == null) { throw new IllegalArgumentException("ds cannot be null"); } ds.setBasedir(dir); PatternSet ps = mergePatterns(p); p.log(getDataTypeName() + ": Setup scanner in dir " + dir + " with " + ps, Project.MSG_DEBUG); ds.setIncludes(ps.getIncludePatterns(p)); ds.setExcludes(ps.getExcludePatterns(p)); if (ds instanceof SelectorScanner) { SelectorScanner ss = (SelectorScanner) ds; ss.setSelectors(getSelectors(p)); } if (useDefaultExcludes) { ds.addDefaultExcludes(); } ds.setCaseSensitive(caseSensitive); }