/** * Set whether to cache collections. * @param b boolean cache flag. */ public synchronized void setCache(final boolean b) { if (isReference()) { throw tooManyAttributes(); } cache = b; }
/** * Determines the types of resources to return. * @param type the types of resources to return */ public void setType(final SetType type) { if (isReference()) { throw tooManyAttributes(); } this.type = type; }
/** * Adds a basedir as nested element. * @param r basedir */ public void addConfiguredBaseDir(final FileResource r) { if (isReference()) { throw noChildrenAllowed(); } baseDirs.add(r.getFile()); }
/** * Adds basedirs as a comma separated list. * @param dirs directories as CSV */ public void setBaseDirs(final String dirs) { if (isReference()) { throw tooManyAttributes(); } if (dirs != null && !dirs.isEmpty()) { for (final String d : dirs.split(",")) { baseDirs.add(getProject().resolveFile(d)); } } }
/** * Return a MultiRootFileSet that has the same basedirs and same patternsets * as this one. * @return the cloned MultiRootFileSet. */ @Override public Object clone() { if (isReference()) { return getRef(getProject()).clone(); } final MultiRootFileSet fs = (MultiRootFileSet) super.clone(); fs.baseDirs = new ArrayList<>(baseDirs); fs.union = null; return fs; }
/** * Fulfill the ResourceCollection contract. * @return an Iterator of Resources. */ @Override public Iterator<Resource> iterator() { if (isReference()) { return ((MultiRootFileSet) getRef(getProject())).iterator(); } return merge().iterator(); }
/** * Returns included directories as a list of semicolon-separated paths. * * @return a <code>String</code> of included directories. */ @Override public String toString() { if (isReference()) { return getRef(getProject()).toString(); } return merge().toString(); }
/** * Fulfill the ResourceCollection contract. * @return number of elements as int. */ @Override public int size() { if (isReference()) { return ((MultiRootFileSet) getRef(getProject())).size(); } return merge().size(); }