Class GuideValueMapResource

  • All Implemented Interfaces:
    Adaptable, Resource

    public class GuideValueMapResource
    extends ValueMapResource
    An extension of ValueMapResource implementation that can return parent resource of this synthetic resource if passed through its constructor.
    • Constructor Detail

      • GuideValueMapResource

        public GuideValueMapResource​(ResourceResolver resourceResolver,
                                     java.lang.String path,
                                     java.lang.String resourceType,
                                     ValueMap vm,
                                     Resource parentResource)
        Creates a GuideValueMapResource based on provided parameters
        Parameters:
        resourceResolver - The resource resolver
        path - The resource path
        resourceType - The resource type
        vm - The properties of the resource
        parentResource - parent resource of this synthetic resource.
      • GuideValueMapResource

        public GuideValueMapResource​(ResourceResolver resourceResolver,
                                     java.lang.String path,
                                     java.lang.String resourceType,
                                     ValueMap vm,
                                     java.util.Collection<Resource> children,
                                     Resource parentResource)
        Creates a GuideValueMapResource based on provided parameters, with the ability to define the children and its parent.
        Parameters:
        resourceResolver - The resource resolver
        path - The resource path
        resourceType - The resource type
        vm - The properties of the resource
        children - The children of the resource
        parentResource - parent resource of this synthetic resource.
      • GuideValueMapResource

        public GuideValueMapResource​(ResourceResolver resourceResolver,
                                     ResourceMetadata rm,
                                     java.lang.String resourceType,
                                     ValueMap vm,
                                     Resource parentResource)
        Creates a GuideValueMapResource based on provided parameters
        Parameters:
        resourceResolver - The resource resolver
        rm - The resource meta data
        resourceType - The resource type
        vm - The properties of the resource
        parentResource - parent resource of this synthetic resource.
      • GuideValueMapResource

        public GuideValueMapResource​(ResourceResolver resourceResolver,
                                     ResourceMetadata rm,
                                     java.lang.String resourceType,
                                     ValueMap vm,
                                     java.util.Collection<Resource> children,
                                     Resource parentResource)
        Creates a ValueMapResource based on provided parameters, with the ability to define the children
        Parameters:
        resourceResolver - The resource resolver
        rm - The resource meta data
        resourceType - The resource type
        vm - The properties of the resource
        children - The children of the resource
        parentResource - parent resource of this synthetic resource.
    • Method Detail

      • adaptTo

        public <Type> Type adaptTo​(java.lang.Class<Type> type)
        Description copied from class: SlingAdaptable
        Calls into the registered AdapterManager to adapt this object to the desired type.

        This method implements a cache of adapters to improve performance. That is repeated calls to this method with the same class will result in the same object to be returned.

        Specified by:
        adaptTo in interface Adaptable
        Overrides:
        adaptTo in class ValueMapResource
        Type Parameters:
        Type - The generic type to which this resource is adapted to
        Parameters:
        type - The Class object of the target type, such as javax.jcr.Node.class or java.io.File.class
        Returns:
        The adapter target or null if the resource cannot adapt to the requested type
      • getChild

        public Resource getChild​(java.lang.String relPath)
        Description copied from class: AbstractResource
        Returns the indicated child of this resource.

        This method is implemented calling the ResourceResolver.getResource(Resource, String) method. As such the relPath argument may even be an absolute path or a path containing relative path segments . (current resource) and .. (parent resource).

        Implementations should not generally overwrite this method without calling this base class implementation.

        Specified by:
        getChild in interface Resource
        Overrides:
        getChild in class ValueMapResource
        Parameters:
        relPath - relative path to the child resource
        Returns:
        The child resource or null
        See Also:
        Resource.getChild(String)