Class SyntheticResource

All Implemented Interfaces:
Adaptable, Resource
Direct Known Subclasses:
NonExistingResource, RedirectResource, StarResource

public class SyntheticResource extends AbstractResource
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.
  • Constructor Details

    • SyntheticResource

      public SyntheticResource(@NotNull @NotNull ResourceResolver resourceResolver, @NotNull @NotNull String path, @NotNull @NotNull String resourceType)
      Creates a synthetic resource with the given path and resourceType.
      Parameters:
      resourceResolver - The resource resolver
      path - The resource path
      resourceType - 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 given ResourceMetadata and resourceType.
      Parameters:
      resourceResolver - The resource resolver
      rm - The resource meta data
      resourceType - The type of the resource
  • Method Details

    • getPath

      @NotNull public @NotNull String getPath()
      Description copied from interface: Resource
      Returns the absolute path of this resource in the resource tree.
      Returns:
      The resource path
      See Also:
    • getResourceType

      @NotNull public @NotNull 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 the ResourceResolver 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

      public 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 the ResourceMetadata.RESOLUTION_PATH property.
      Returns:
      The resource meta data
      See Also:
    • getResourceResolver

      @NotNull public @NotNull ResourceResolver getResourceResolver()
      Returns the ResourceResolver with which this synthetic resource is related or null if none.
      Returns:
      The resource resolver
    • toString

      public String toString()
      Overrides:
      toString in class Object