|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.sling.api.adapter.SlingAdaptable
org.apache.sling.api.resource.AbstractResource
public abstract class AbstractResource
The AbstractResource is an abstract implementation of the
Resource interface.
Implementations of the Resource interface are strongly encouraged to
either extend from this class or the ResourceWrapper class instead of
implementing the Resource from the ground up. This will ensure to
always be able to support new methods that might be introduced in the
Resource interface in the future.
| Field Summary |
|---|
| Fields inherited from interface org.apache.sling.api.resource.Resource |
|---|
RESOURCE_TYPE_NON_EXISTING |
| Constructor Summary | |
|---|---|
AbstractResource()
|
|
| Method Summary | |
|---|---|
Resource |
getChild(String relPath)
Returns the indicated child of this resource. |
String |
getName()
Returns the name of this resource. |
Resource |
getParent()
Returns the parent resource of this resource. |
boolean |
isResourceType(String resourceType)
Returns true if this resource is of the given resource type
or if any of the super resource types equals the given resource type. |
Iterator<Resource> |
listChildren()
Returns an iterator on the direct child resources. |
| Methods inherited from class org.apache.sling.api.adapter.SlingAdaptable |
|---|
adaptTo, setAdapterManager, unsetAdapterManager |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.sling.api.resource.Resource |
|---|
getPath, getResourceMetadata, getResourceResolver, getResourceSuperType, getResourceType |
| Methods inherited from interface org.apache.sling.api.adapter.Adaptable |
|---|
adaptTo |
| Constructor Detail |
|---|
public AbstractResource()
| Method Detail |
|---|
public String getName()
This method is implemented as a pure string operation by calling the
ResourceUtil.getName(String) method with the path of this
resource.
getName in interface Resourcepublic Resource getParent()
This method is implemented by getting the parent resource path first
calling the ResourceUtil.getParent(String) method and then to
retrieve that resource from the resource resolver.
getParent in interface Resourcepublic Resource getChild(String relPath)
This method is implemented calling the
ResourceResolver.getResource(Resource, String) method. As such
the relPath argument may even be an absolute path or a path
containing relative path segments . (current resource) and
.. (parent resource).
Implementations should not generally overwrite this method without calling this base class implementation.
getChild in interface ResourceResourceResolver.getResource(Resource, String)public Iterator<Resource> listChildren()
This method is implemented calling the
ResourceResolver.listChildren(Resource) method.
Implementations should not generally overwrite this method without calling this base class implementation.
listChildren in interface ResourceResourceResolver.listChildren(Resource)public boolean isResourceType(String resourceType)
true if this resource is of the given resource type
or if any of the super resource types equals the given resource type.
This method is implemented by first checking the resource type then
walking up the resource super type chain using the
ResourceUtil.findResourceSuperType(Resource) and
ResourceUtil.getResourceSuperType(ResourceResolver, String)
methods.
isResourceType in interface ResourceresourceType - The resource type to check this resource against.
true if the resource type or any of the resource's
super type(s) equals the given resource type. false
is also returned if resourceType is
null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||