Author: dklco
Date: Wed Oct 30 15:38:30 2013
New Revision: 1537134
URL: http://svn.apache.org/r1537134
Log:
Finishing SLING-3213 : Adding support for the method 'hasChildren' on Resource
and ResourceResolvers
Modified:
sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/SlingFunctions.java
Modified:
sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/SlingFunctions.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/SlingFunctions.java?rev=1537134&r1=1537133&r2=1537134&view=diff
==============================================================================
---
sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/SlingFunctions.java
(original)
+++
sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/SlingFunctions.java
Wed Oct 30 15:38:30 2013
@@ -159,6 +159,30 @@ public class SlingFunctions {
}
/**
+ * Method for checking whether or not a resource has child resources.
+ *
+ * @param resource
+ * the resource to check for child resources
+ * @return true if the resource has child resources, false otherwise
+ * @since 2.2.2
+ */
+ public static final boolean hasChildren(Resource resource) {
+ return resource != null ? resource.listChildren().hasNext() :
false;
+ }
+
+ /**
+ * Method for checking whether or not a resource has child resources.
+ *
+ * @param resource
+ * the resource to check for child resources
+ * @return true if the resource has child resources, false otherwise
+ * @since 2.2.2
+ */
+ public static final boolean hasChildren(Resource resource) {
+ return resource != null ? resource.listChildren().hasNext() :
false;
+ }
+
+ /**
* Method for allowing the invocation of the Sling Resource listChildren
* method.
*