Class StarResource
java.lang.Object
org.apache.sling.api.adapter.SlingAdaptable
org.apache.sling.api.resource.AbstractResource
org.apache.sling.api.resource.SyntheticResource
org.apache.sling.resourceresolver.impl.helper.StarResource
@Adaptable(adaptableClass=Resource.class,
adapters=@Adapter(java.lang.String.class))
public class StarResource
extends SyntheticResource
Used to provide the equivalent of an empty Node for GET requests to
*.something (SLING-344)
-
Field Summary
FieldsFields inherited from interface org.apache.sling.api.resource.Resource
RESOURCE_TYPE_NON_EXISTING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<Type> Type
Calls into the registeredAdapterManager
to adapt this object to the desiredtype
.static boolean
True if a StarResource should be used for the given request, if a real Resource was not foundCallsResourceUtil.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 theSLASH_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
-
Field Details
-
DEFAULT_RESOURCE_TYPE
- See Also:
-
-
Constructor Details
-
StarResource
-
-
Method Details
-
appliesTo
True if a StarResource should be used for the given request, if a real Resource was not found- Parameters:
path
- the path- Returns:
- true if the StarResource should be used, false otherwise
-
isStarResource
Returns true if the path of the resource ends with theSLASH_STAR
and therefore should be considered a star resource.- Parameters:
res
- the resource- Returns:
- true if the StarResource should be used, false otherwise
-
getResourceSuperType
CallsResourceUtil.getResourceSuperType(ResourceResolver, String)
method to dynamically resolve the resource super type of this star resource.- Specified by:
getResourceSuperType
in interfaceResource
- Overrides:
getResourceSuperType
in classSyntheticResource
- Returns:
- the resource supertype
-
adaptTo
Description copied from class:SlingAdaptable
Calls into the registeredAdapterManager
to adapt this object to the desiredtype
.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 interfaceAdaptable
- Overrides:
adaptTo
in classSlingAdaptable
- Type Parameters:
Type
- The generic type to which this resource is adapted to- Parameters:
type
- The Class object of the target type, such asjavax.jcr.Node.class
orjava.io.File.class
- Returns:
- The adapter target or
null
if the resource cannot adapt to the requested type
-