/** * Returns a textual representation of the path, which can be used as * CLASSPATH or PATH environment variable definition. * @return a textual representation of the path. */ @Override public String toString() { return isReference() ? getCheckedRef().toString() : union == null ? "" : union.toString(); }
/** * Creates the nested <code><pathelement></code> element. * @return the <code>PathElement</code> to be configured * @throws BuildException on error */ public PathElement createPathElement() throws BuildException { if (isReference()) { throw noChildrenAllowed(); } PathElement pe = new PathElement(); add(pe); return pe; }
/** * Returns all path elements defined by this and nested path objects. * @return list of path elements. */ public String[] list() { if (isReference()) { return ((Path) getCheckedRef()).list(); } return assertFilesystemOnly(union) == null ? new String[0] : union.list(); }
/** * Fulfill the ResourceCollection contract. * @return whether this is a filesystem-only resource collection. */ @Override public synchronized boolean isFilesystemOnly() { if (isReference()) { return ((Path) getCheckedRef()).isFilesystemOnly(); } dieOnCircularReference(); assertFilesystemOnly(union); return true; }
/** * Fulfill the ResourceCollection contract. * @return number of elements as int. */ @Override public synchronized int size() { if (isReference()) { return ((Path) getCheckedRef()).size(); } dieOnCircularReference(); return union == null ? 0 : assertFilesystemOnly(union).size(); }
/** * Overrides the version of DataType to recurse on all DataType * child elements that may have been added. * @param stk the stack of data types to use (recursively). * @param p the project to use to dereference the references. * @throws BuildException on error. */ @Override protected synchronized void dieOnCircularReference(Stack<Object> stk, Project p) throws BuildException { if (isChecked()) { return; } if (isReference()) { super.dieOnCircularReference(stk, p); } else { if (union != null) { pushAndInvokeCircularReferenceCheck(union, stk, p); } setChecked(true); } }
/** * Fulfill the ResourceCollection contract. The Iterator returned * will throw ConcurrentModificationExceptions if ResourceCollections * are added to this container while the Iterator is in use. * @return a "fail-fast" Iterator. */ @Override public final synchronized Iterator<Resource> iterator() { if (isReference()) { return ((Path) getCheckedRef()).iterator(); } dieOnCircularReference(); if (getPreserveBC()) { return new FileResourceIterator(getProject(), null, list()); } return union == null ? Collections.<Resource> emptySet().iterator() : assertFilesystemOnly(union).iterator(); }