Package org.apache.sling.api.resource
Class SyntheticResource
java.lang.Object
org.apache.sling.api.adapter.SlingAdaptable
org.apache.sling.api.resource.AbstractResource
org.apache.sling.api.resource.SyntheticResource
- Direct Known Subclasses:
NonExistingResource
,RedirectResource
,StarResource
The
SyntheticResource
class is a simple implementation of the
Resource
interface which may be used to provide a resource
object which has no actual resource data.-
Field Summary
Fields inherited from interface org.apache.sling.api.resource.Resource
RESOURCE_TYPE_NON_EXISTING
-
Constructor Summary
ConstructorDescriptionSyntheticResource
(@NotNull ResourceResolver resourceResolver, @NotNull String path, @NotNull String resourceType) Creates a synthetic resource with the givenpath
andresourceType
.SyntheticResource
(@NotNull ResourceResolver resourceResolver, @NotNull ResourceMetadata rm, @NotNull String resourceType) Creates a synthetic resource with the givenResourceMetadata
andresourceType
. -
Method Summary
Modifier and TypeMethodDescription@NotNull String
getPath()
Returns the absolute path of this resource in the resource tree.@NotNull ResourceMetadata
Returns a resource metadata object containing just the path of this resource as theResourceMetadata.RESOLUTION_PATH
property.@NotNull ResourceResolver
Returns theResourceResolver
with which this synthetic resource is related ornull
if none.Synthetic resources by default do not have a resource super type.@NotNull String
The resource type is meant to point to rendering/processing scripts, editing dialogs, etc.toString()
Methods inherited from class org.apache.sling.api.resource.AbstractResource
getChild, getChildren, getName, getParent, getValueMap, hasChildren, isResourceType, listChildren
Methods inherited from class org.apache.sling.api.adapter.SlingAdaptable
adaptTo, setAdapterManager, unsetAdapterManager
-
Constructor Details
-
SyntheticResource
public SyntheticResource(@NotNull @NotNull ResourceResolver resourceResolver, @NotNull @NotNull String path, @NotNull @NotNull String resourceType) Creates a synthetic resource with the givenpath
andresourceType
.- Parameters:
resourceResolver
- The resource resolverpath
- The resource pathresourceType
- The type of the resource
-
SyntheticResource
public SyntheticResource(@NotNull @NotNull ResourceResolver resourceResolver, @NotNull @NotNull ResourceMetadata rm, @NotNull @NotNull String resourceType) Creates a synthetic resource with the givenResourceMetadata
andresourceType
.- Parameters:
resourceResolver
- The resource resolverrm
- The resource meta dataresourceType
- The type of the resource
-
-
Method Details
-
getPath
Description copied from interface:Resource
Returns the absolute path of this resource in the resource tree.- Returns:
- The resource path
- See Also:
-
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
.- Returns:
- The resource type
- See Also:
-
getResourceSuperType
Synthetic resources by default do not have a resource super type.- Returns:
- The super type of the resource or
null
.
-
getResourceMetadata
Returns a resource metadata object containing just the path of this resource as theResourceMetadata.RESOLUTION_PATH
property.- Returns:
- The resource meta data
- See Also:
-
getResourceResolver
Returns theResourceResolver
with which this synthetic resource is related ornull
if none.- Returns:
- The resource resolver
-
toString
-