You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/03/28 11:00:17 UTC
svn commit: r642178 -
/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceUtil.java
Author: fmeschbe
Date: Fri Mar 28 03:00:14 2008
New Revision: 642178
URL: http://svn.apache.org/viewvc?rev=642178&view=rev
Log:
SLING-345 Add new helper method isSyntheticResource
Modified:
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceUtil.java
Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceUtil.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceUtil.java?rev=642178&r1=642177&r2=642178&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceUtil.java (original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceUtil.java Fri Mar 28 03:00:14 2008
@@ -29,6 +29,7 @@
import org.apache.sling.api.resource.NonExistingResource;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.SyntheticResource;
import org.apache.sling.jcr.resource.internal.helper.LazyInputStream;
import org.apache.sling.jcr.resource.internal.helper.starresource.StarResource;
import org.slf4j.Logger;
@@ -262,6 +263,24 @@
// get the resource super type from the resource
return (rtResource != null) ? rtResource.getResourceSuperType() : null;
+ }
+
+ /**
+ * Returns <code>true</code> if the resource <code>res</code> is a
+ * synthetic resource.
+ * <p>
+ * This method checks whether the resource is an instance of the
+ * <code>org.apache.sling.resource.SyntheticResource</code> class.
+ *
+ * @param res The <code>Resource</code> to check whether it is a synthetic
+ * resource.
+ * @return <code>true</code> if <code>res</code> is a synthetic
+ * resource. <code>false</code> is returned if <code>res</code>
+ * is <code>null</code> or not an instance of the
+ * <code>org.apache.sling.resource.SyntheticResource</code> class.
+ */
+ public static boolean isSyntheticResource(Resource res) {
+ return res instanceof SyntheticResource;
}
/**