org.apache.sling.jcr.resource.internal.helper.starresource
Class StarResource

java.lang.Object
  extended by org.apache.sling.api.adapter.SlingAdaptable
      extended by org.apache.sling.api.resource.AbstractResource
          extended by org.apache.sling.api.resource.SyntheticResource
              extended by org.apache.sling.jcr.resource.internal.helper.starresource.StarResource
All Implemented Interfaces:
Adaptable, Resource

public class StarResource
extends SyntheticResource

Used to provide the equivalent of an empty Node for GET requests to *.something (SLING-344)


Field Summary
static String DEFAULT_RESOURCE_TYPE
           
 
Fields inherited from interface org.apache.sling.api.resource.Resource
RESOURCE_TYPE_NON_EXISTING
 
Constructor Summary
StarResource(ResourceResolver resourceResolver, String path)
           
 
Method Summary
<Type> Type
adaptTo(Class<Type> type)
          Adapts the adaptable to another 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(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, getName, getParent, isResourceType, listChildren
 
Methods inherited from class org.apache.sling.api.adapter.SlingAdaptable
setAdapterManager, unsetAdapterManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_RESOURCE_TYPE

public static final String DEFAULT_RESOURCE_TYPE
See Also:
Constant Field Values
Constructor Detail

StarResource

public StarResource(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(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 Resource
Overrides:
getResourceSuperType in class SyntheticResource

adaptTo

public <Type> Type adaptTo(Class<Type> type)
Description copied from interface: Adaptable
Adapts the adaptable to another type.

Specified by:
adaptTo in interface Adaptable
Overrides:
adaptTo in class SlingAdaptable
Type Parameters:
Type - The generic type to which this resource is adapted to
Parameters:
type - The Class object of the target type, such as Node.class
Returns:
The adapter target or null if the resource cannot adapt to the requested type
See Also:
Adaptable.adaptTo(java.lang.Class)


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.