You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2008/08/18 21:25:51 UTC
svn commit: r686856 -
/incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
Author: cziegeler
Date: Mon Aug 18 12:25:49 2008
New Revision: 686856
URL: http://svn.apache.org/viewvc?rev=686856&view=rev
Log:
SLING-618 : Add ResourceUtil#listChildren method
Modified:
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
Modified: incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java?rev=686856&r1=686855&r2=686856&view=diff
==============================================================================
--- incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java (original)
+++ incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java Mon Aug 18 12:25:49 2008
@@ -18,6 +18,8 @@
*/
package org.apache.sling.api.resource;
+import java.util.Iterator;
+
/**
* The <code>ResourceUtil</code> class provides helper methods dealing
@@ -247,4 +249,22 @@
public static boolean isNonExistingResource(Resource res) {
return NonExistingResource.RESOURCE_TYPE_NON_EXISTING.equals(res.getResourceType());
}
+
+ /**
+ * Returns an <code>Iterator</code> of {@link Resource} objects loaded
+ * from the children of the given <code>Resource</code>.
+ * <p>
+ * This is a convenience method for {@link ResourceResolver#listChildren(Resource)}.
+ *
+ * @param parent The {@link Resource Resource} whose children are requested.
+ * @return An <code>Iterator</code> of {@link Resource} objects.
+ * @throws NullPointerException If <code>parent</code> is
+ * <code>null</code>.
+ * @throws org.apache.sling.api.SlingException If any error occurs acquiring
+ * the child resource iterator.
+ * @see ResourceResolver#listChildren(Resource)
+ */
+ public static Iterator<Resource> listChildren(Resource parent) {
+ return parent.getResourceResolver().listChildren(parent);
+ }
}