Author: cziegeler
Date: Tue Apr 6 06:25:44 2010
New Revision: 931033
URL: http://svn.apache.org/viewvc?rev=931033&view=rev
Log:
Some javadocs.
Modified:
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceWrapper.java
Modified:
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java?rev=931033&r1=931032&r2=931033&view=diff
==============================================================================
---
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
(original)
+++
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
Tue Apr 6 06:25:44 2010
@@ -413,7 +413,15 @@ public class ResourceUtil {
}
/**
- * @param <T>
+ * Return an iterator for objecs of the specified type.
+ * A new iterator is returned which tries to adapt the provided resources
+ * to the given type (using {...@link Resource#adaptTo(Class)}.
+ * If a resource in the original iterator is not adaptable to the given
+ * class, this object is skipped. This implies that the number of objects
+ * returned by the new iterator might be less than the number of resource
+ * objects.
+ * @param iterator A resource iterator.
+ * @param <T> The adapted type
* @since 2.0.6
*/
public static <T> Iterator<T> adaptTo(final Iterator<Resource> iterator,
final Class<T> type) {
Modified:
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceWrapper.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceWrapper.java?rev=931033&r1=931032&r2=931033&view=diff
==============================================================================
---
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceWrapper.java
(original)
+++
sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceWrapper.java
Tue Apr 6 06:25:44 2010
@@ -26,7 +26,7 @@ package org.apache.sling.api.resource;
*/
public class ResourceWrapper implements Resource {
- // the wrapped resource
+ /** the wrapped resource */
private final Resource resource;
/**
@@ -39,35 +39,58 @@ public class ResourceWrapper implements
/**
* Returns the <code>Resource</code> wrapped by this instance.
+ * This method can be overwritten by subclasses if required. All
+ * other methods use this method to get the resource object.
*/
public Resource getResource() {
return resource;
}
+ /**
+ * @see org.apache.sling.api.resource.Resource#getPath()
+ */
public String getPath() {
- return resource.getPath();
+ return getResource().getPath();
}
+ /**
+ * @see org.apache.sling.api.resource.Resource#getResourceMetadata()
+ */
public ResourceMetadata getResourceMetadata() {
- return resource.getResourceMetadata();
+ return getResource().getResourceMetadata();
}
+ /**
+ * @see org.apache.sling.api.resource.Resource#getResourceResolver()
+ */
public ResourceResolver getResourceResolver() {
- return resource.getResourceResolver();
+ return getResource().getResourceResolver();
}
+ /**
+ * @see org.apache.sling.api.resource.Resource#getResourceType()
+ */
public String getResourceType() {
- return resource.getResourceType();
+ return getResource().getResourceType();
}
+ /**
+ * @see org.apache.sling.api.resource.Resource#getResourceSuperType()
+ */
public String getResourceSuperType() {
- return resource.getResourceSuperType();
+ return getResource().getResourceSuperType();
}
-
+
+ /**
+ * @see org.apache.sling.api.adapter.Adaptable#adaptTo(java.lang.Class)
+ */
public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
- return resource.adaptTo(type);
+ return getResource().adaptTo(type);
}
+ /**
+ * @see java.lang.Object#toString()
+ */
public String toString() {
return getClass().getSimpleName() + ", type=" + getResourceType()
+ ", path=" + getPath() + ", resource=[" + getResource() + "]";