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> TypeCalls into the registeredAdapterManagerto adapt this object to the desiredtype.static booleanTrue 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 booleanisStarResource(Resource res) Returns true if the path of the resource ends with theSLASH_STARand therefore should be considered a star resource.Methods inherited from class org.apache.sling.api.resource.SyntheticResource
getPath, getResourceMetadata, getResourceResolver, getResourceType, toStringMethods inherited from class org.apache.sling.api.resource.AbstractResource
getChild, getChildren, getName, getParent, getValueMap, hasChildren, isResourceType, listChildrenMethods 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_STARand 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:
getResourceSuperTypein interfaceResource- Overrides:
getResourceSuperTypein classSyntheticResource- Returns:
- the resource supertype
-
adaptTo
Description copied from class:SlingAdaptableCalls into the registeredAdapterManagerto 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:
adaptToin interfaceAdaptable- Overrides:
adaptToin 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.classorjava.io.File.class- Returns:
- The adapter target or
nullif the resource cannot adapt to the requested type
-