/** * 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(); }
/** * 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(); }
/** * 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(); }