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:
MergedMultiResource
,NonExistingResource
,ValueMapResource
public class SyntheticResource extends AbstractResource
TheSyntheticResource
class is a simple implementation of theResource
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
Constructors Constructor Description SyntheticResource(@NotNull ResourceResolver resourceResolver, @NotNull java.lang.String path, @NotNull java.lang.String resourceType)
Creates a synthetic resource with the givenpath
andresourceType
.SyntheticResource(@NotNull ResourceResolver resourceResolver, @NotNull ResourceMetadata rm, @NotNull java.lang.String resourceType)
Creates a synthetic resource with the givenResourceMetadata
andresourceType
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull java.lang.String
getPath()
Returns the absolute path of this resource in the resource tree.@NotNull ResourceMetadata
getResourceMetadata()
Returns a resource metadata object containing just the path of this resource as theResourceMetadata.RESOLUTION_PATH
property.@NotNull ResourceResolver
getResourceResolver()
Returns theResourceResolver
with which this synthetic resource is related ornull
if none.java.lang.String
getResourceSuperType()
Synthetic resources by default do not have a resource super type.@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.AbstractResource
getChild, getChildren, getName, getParent, getValueMap, hasChildren, isResourceType, listChildren
-
Methods inherited from class org.apache.sling.api.adapter.SlingAdaptable
adaptTo, setAdapterManager, unsetAdapterManager
-
-
-
-
Constructor Detail
-
SyntheticResource
public SyntheticResource(@NotNull @NotNull ResourceResolver resourceResolver, @NotNull @NotNull java.lang.String path, @NotNull @NotNull java.lang.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 java.lang.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 Detail
-
getPath
@NotNull public @NotNull java.lang.String getPath()
Description copied from interface:Resource
Returns the absolute path of this resource in the resource tree.- Returns:
- The resource path
- See Also:
Resource.getPath()
-
getResourceType
@NotNull public @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
.- Returns:
- The resource type
- See Also:
Resource.getResourceType()
-
getResourceSuperType
public java.lang.String getResourceSuperType()
Synthetic resources by default do not have a resource super type.- Returns:
- The super type of the resource or
null
.
-
getResourceMetadata
@NotNull public @NotNull ResourceMetadata 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:
ResourceMetadata
-
getResourceResolver
@NotNull public @NotNull ResourceResolver getResourceResolver()
Returns theResourceResolver
with which this synthetic resource is related ornull
if none.- Returns:
- The resource resolver
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-