Package org.apache.sling.api.resource
Class NonExistingResource
- java.lang.Object
-
- org.apache.sling.api.adapter.SlingAdaptable
-
- org.apache.sling.api.resource.AbstractResource
-
- org.apache.sling.api.resource.SyntheticResource
-
- org.apache.sling.api.resource.NonExistingResource
-
public final class NonExistingResource extends SyntheticResource
Simple helper class representing nonexisting resources. This is an utility class to create non existing resources. It is not meant to be used to check if a resource is a non existing resource. Use theResourceUtil.isNonExistingResource(Resource)
method instead (or check the resource type yourself). The reason for this is that this resource might be wrapped by other resource implementations like resource decorators etc.
-
-
Field Summary
-
Fields inherited from interface org.apache.sling.api.resource.Resource
RESOURCE_TYPE_NON_EXISTING
-
-
Constructor Summary
Constructors Constructor Description NonExistingResource(ResourceResolver resourceResolver, java.lang.String resourceURI)
Create a new non existing resource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Resource
getParent()
Returns the parent resource of this resource.@NotNull java.lang.String
getResourceType()
The resource type is meant to point to rendering/processing scripts, editing dialogs, etc.java.lang.String
toString()
-
Methods inherited from class org.apache.sling.api.resource.SyntheticResource
getPath, getResourceMetadata, getResourceResolver, getResourceSuperType
-
Methods inherited from class org.apache.sling.api.resource.AbstractResource
getChild, getChildren, getName, getValueMap, hasChildren, isResourceType, listChildren
-
Methods inherited from class org.apache.sling.api.adapter.SlingAdaptable
adaptTo, setAdapterManager, unsetAdapterManager
-
-
-
-
Constructor Detail
-
NonExistingResource
public NonExistingResource(ResourceResolver resourceResolver, java.lang.String resourceURI)
Create a new non existing resource.- Parameters:
resourceResolver
- The resource resolver.resourceURI
- The path of the resource.
-
-
Method Detail
-
getResourceType
@NotNull public final @NotNull java.lang.String getResourceType()
Description copied from interface:Resource
The resource type is meant to point to rendering/processing scripts, editing dialogs, etc. It is usually a path in the repository, where scripts and other tools definitions are found, but theResourceResolver
is free to set this to any suitable value such as the primary node type of the JCR node from which the resource is created.If the resource instance represents a resource which is not actually existing, this method returns
Resource.RESOURCE_TYPE_NON_EXISTING
.- Specified by:
getResourceType
in interfaceResource
- Overrides:
getResourceType
in classSyntheticResource
- Returns:
- The resource type
- See Also:
SyntheticResource.getResourceType()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classSyntheticResource
-
getParent
public Resource getParent()
Description copied from class:AbstractResource
Returns the parent resource of this resource.This method is implemented calling the
ResourceResolver.getParent(Resource)
method.- Specified by:
getParent
in interfaceResource
- Overrides:
getParent
in classAbstractResource
- Returns:
- the parent resource (might be a
NonExistingResource
in case the parent does not exist either). - See Also:
ResourceResolver.getParent(Resource)
-
-