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
TheSyntheticResourceclass is a simple implementation of theResourceinterface 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 givenpathandresourceType.SyntheticResource(@NotNull ResourceResolver resourceResolver, @NotNull ResourceMetadata rm, @NotNull java.lang.String resourceType)Creates a synthetic resource with the givenResourceMetadataandresourceType.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull java.lang.StringgetPath()Returns the absolute path of this resource in the resource tree.@NotNull ResourceMetadatagetResourceMetadata()Returns a resource metadata object containing just the path of this resource as theResourceMetadata.RESOLUTION_PATHproperty.@NotNull ResourceResolvergetResourceResolver()Returns theResourceResolverwith which this synthetic resource is related ornullif none.java.lang.StringgetResourceSuperType()Synthetic resources by default do not have a resource super type.@NotNull java.lang.StringgetResourceType()The resource type is meant to point to rendering/processing scripts, editing dialogs, etc.java.lang.StringtoString()-
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 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 java.lang.String resourceType)Creates a synthetic resource with the givenResourceMetadataandresourceType.- 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:ResourceReturns 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: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:
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_PATHproperty.- Returns:
- The resource meta data
- See Also:
ResourceMetadata
-
getResourceResolver
@NotNull public @NotNull ResourceResolver getResourceResolver()
Returns theResourceResolverwith which this synthetic resource is related ornullif none.- Returns:
- The resource resolver
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-