public class AdaptationUtil extends Object
Note: This class is not a part of the public API and is subject to change. Do not use it in your own code
Modifier and Type | Method and Description |
---|---|
static org.apache.sling.api.SlingHttpServletRequest |
getRequest(Object adaptable)
Retrieves a
SlingHttpServletRequest instance from the provided adaptable object |
static org.apache.sling.api.SlingHttpServletRequest |
getRequest(org.apache.sling.api.SlingHttpServletRequest request,
org.apache.sling.api.resource.Resource resource)
Retrieves a
SlingHttpServletRequest instance from the provided initial request and the given Sling
resource |
static org.apache.sling.api.resource.Resource |
getResource(Object adaptable)
Retrieves a
Resource instance from the provided adaptable object if it is assignable from SlingHttpServletRequest or Resource |
static org.apache.sling.api.resource.ResourceResolver |
getResourceResolver(Object adaptable)
Retrieves a
ResourceResolver instance from the provided adaptable object if it is assignable from Resource or SlingHttpServletRequest |
static org.apache.sling.api.resource.ValueMap |
getValueMap(Object adaptable)
Retrieves the
ValueMap instance from the provided adaptable if it is of type SlingHttpServletRequest , or Resource , or else ValueMap |
public static org.apache.sling.api.SlingHttpServletRequest getRequest(Object adaptable)
SlingHttpServletRequest
instance from the provided adaptable objectadaptable
- The object which Sling tries to adapt fromSlingHttpServletRequest
object if adaptable is of an appropriate type, or nullpublic static org.apache.sling.api.SlingHttpServletRequest getRequest(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.resource.Resource resource)
SlingHttpServletRequest
instance from the provided initial request and the given Sling
resourcerequest
- SlingHttpServletRequest
instance used to construct the resulting requestresource
- Sling resource that the resulting request will report as its bundled resourceSlingHttpServletRequest
instancepublic static org.apache.sling.api.resource.Resource getResource(Object adaptable)
Resource
instance from the provided adaptable object if it is assignable from SlingHttpServletRequest
or Resource
adaptable
- The object which Sling tries to adapt fromResource
object if the adaptable
is of an appropriate type, or nullpublic static org.apache.sling.api.resource.ResourceResolver getResourceResolver(Object adaptable)
ResourceResolver
instance from the provided adaptable object if it is assignable from Resource
or SlingHttpServletRequest
adaptable
- The object which Sling tries to adapt fromResourceResolver
object if the adaptable
is of an appropriate type, or nullpublic static org.apache.sling.api.resource.ValueMap getValueMap(Object adaptable)
ValueMap
instance from the provided adaptable if it is of type SlingHttpServletRequest
, or Resource
, or else ValueMap
adaptable
- The object which Sling tries to adapt fromValueMap
if adaptation was successful. Otherwise, an empty ValueMap
is
returnedCopyright © 2024 Exadel, Inc.. All rights reserved.