@Override public void setDir(final File dir) { throw new BuildException(getDataTypeName() + " doesn't support the dir attribute"); }
/** * Fulfill the ResourceCollection contract. * @return an Iterator of Resources. */ @Override public Iterator<Resource> iterator() { if (isReference()) { return ((MultiRootFileSet) getRef(getProject())).iterator(); } return merge().iterator(); }
/** * Set whether to cache collections. * @param b boolean cache flag. */ public synchronized void setCache(final boolean b) { if (isReference()) { throw tooManyAttributes(); } cache = b; }
/** * 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; }
/** * Adds a basedir as nested element. * @param r basedir */ public void addConfiguredBaseDir(final FileResource r) { if (isReference()) { throw noChildrenAllowed(); } baseDirs.add(r.getFile()); }
private synchronized Union merge() { if (cache && union != null) { return union; } final Union u = new Union(); setup(u); if (cache) { union = u; } return u; }
@Override public void setRefid(final Reference r) { if (!baseDirs.isEmpty()) { throw tooManyAttributes(); } super.setRefid(r); }
/** * Fulfill the ResourceCollection contract. * @return number of elements as int. */ @Override public int size() { if (isReference()) { return ((MultiRootFileSet) getRef(getProject())).size(); } return merge().size(); }
/** * 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; }
/** * 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(); }