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
ConstructorsConstructorDescriptionSyntheticResource(@NotNull ResourceResolver resourceResolver, @NotNull String path, @NotNull String resourceType) Creates a synthetic resource with the givenpathandresourceType.SyntheticResource(@NotNull ResourceResolver resourceResolver, @NotNull ResourceMetadata rm, @NotNull String resourceType) Creates a synthetic resource with the givenResourceMetadataandresourceType. -
Method Summary
Modifier and TypeMethodDescription@NotNull StringgetPath()Returns the absolute path of this resource in the resource tree.@NotNull ResourceMetadataReturns a resource metadata object containing just the path of this resource as theResourceMetadata.RESOLUTION_PATHproperty.@NotNull ResourceResolverReturns theResourceResolverwith which this synthetic resource is related ornullif none.Synthetic resources by default do not have a resource super type.@NotNull StringThe 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, listChildrenMethods 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 givenpathandresourceType.- 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 givenResourceMetadataandresourceType.- Parameters:
resourceResolver- The resource resolverrm- The resource meta dataresourceType- The type of the resource
-
-
Method Details
-
getPath
Description copied from interface:ResourceReturns the absolute path of this resource in the resource tree.- Returns:
- The resource path
- See Also:
-
getResourceType
Description copied from interface:ResourceThe 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 theResourceResolveris 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_PATHproperty.- Returns:
- The resource meta data
- See Also:
-
getResourceResolver
Returns theResourceResolverwith which this synthetic resource is related ornullif none.- Returns:
- The resource resolver
-
toString
-