Class StarResource

  • All Implemented Interfaces:
    org.apache.sling.api.adapter.Adaptable, org.apache.sling.api.resource.Resource

    @Adaptable(adaptableClass=org.apache.sling.api.resource.Resource.class,
               adapters=@Adapter(java.lang.String.class))
    public class StarResource
    extends org.apache.sling.api.resource.SyntheticResource
    Used to provide the equivalent of an empty Node for GET requests to *.something (SLING-344)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String DEFAULT_RESOURCE_TYPE  
      • Fields inherited from interface org.apache.sling.api.resource.Resource

        RESOURCE_TYPE_NON_EXISTING
    • Constructor Summary

      Constructors 
      Constructor Description
      StarResource​(org.apache.sling.api.resource.ResourceResolver resourceResolver, String path)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <Type> Type adaptTo​(Class<Type> type)  
      static boolean appliesTo​(String path)
      True if a StarResource should be used for the given request, if a real Resource was not found
      String getResourceSuperType()
      Calls ResourceUtil.getResourceSuperType(ResourceResolver, String) method to dynamically resolve the resource super type of this star resource.
      static boolean isStarResource​(org.apache.sling.api.resource.Resource res)
      Returns true if the path of the resource ends with the SLASH_STAR and therefore should be considered a star resource.
      • Methods inherited from class org.apache.sling.api.resource.SyntheticResource

        getPath, getResourceMetadata, getResourceResolver, getResourceType, 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

        setAdapterManager, unsetAdapterManager
    • Constructor Detail

      • StarResource

        public StarResource​(org.apache.sling.api.resource.ResourceResolver resourceResolver,
                            String path)
    • Method Detail

      • appliesTo

        public static boolean appliesTo​(String path)
        True if a StarResource should be used for the given request, if a real Resource was not found
      • isStarResource

        public static boolean isStarResource​(org.apache.sling.api.resource.Resource res)
        Returns true if the path of the resource ends with the SLASH_STAR and therefore should be considered a star resource.
      • getResourceSuperType

        public String getResourceSuperType()
        Calls ResourceUtil.getResourceSuperType(ResourceResolver, String) method to dynamically resolve the resource super type of this star resource.
        Specified by:
        getResourceSuperType in interface org.apache.sling.api.resource.Resource
        Overrides:
        getResourceSuperType in class org.apache.sling.api.resource.SyntheticResource
      • adaptTo

        public <Type> Type adaptTo​(Class<Type> type)
        Specified by:
        adaptTo in interface org.apache.sling.api.adapter.Adaptable
        Overrides:
        adaptTo in class org.apache.sling.api.adapter.SlingAdaptable