Package com.composum.sling.core
Class BeanContext.Map
- java.lang.Object
-
- org.apache.sling.api.adapter.SlingAdaptable
-
- com.composum.sling.core.BeanContext.AbstractContext
-
- com.composum.sling.core.BeanContext.AbstractScriptContext
-
- com.composum.sling.core.BeanContext.Map
-
- All Implemented Interfaces:
BeanContext,Cloneable,org.apache.sling.api.adapter.Adaptable
- Direct Known Subclasses:
BeanContext.Service
- Enclosing interface:
- BeanContext
public static class BeanContext.Map extends BeanContext.AbstractScriptContext
a Map based implementation of the context interface (e.g. for a Groovy script)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.composum.sling.core.BeanContext
BeanContext.AbstractContext, BeanContext.AbstractScriptContext, BeanContext.Map, BeanContext.Page, BeanContext.Scope, BeanContext.Service, BeanContext.Servlet, BeanContext.Wrapper
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.sling.api.SlingHttpServletRequestrequestprotected org.apache.sling.api.resource.ResourceResolverresolverprotected org.apache.sling.api.resource.Resourceresource-
Fields inherited from class com.composum.sling.core.BeanContext.AbstractScriptContext
scriptHelper, slingBindings
-
Fields inherited from class com.composum.sling.core.BeanContext.AbstractContext
locale
-
Fields inherited from interface com.composum.sling.core.BeanContext
ATTR_LOCALE, ATTR_REQUEST, ATTR_RESOLVER, ATTR_RESOURCE, ATTR_RESPONSE
-
-
Constructor Summary
Constructors Constructor Description Map()Map(Map<String,Object> pageScopeMap)Map(Map<String,Object> pageScopeMap, Map<String,Object> requestScopeMap)Map(Map<String,Object> pageScopeMap, Map<String,Object> requestScopeMap, Map<String,Object> sessionScopeMap)Map(Map<String,Object> pageScopeMap, org.apache.sling.api.SlingHttpServletRequest request)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TgetAttribute(String name, Class<T> T)Returns an attribute value from the context.org.apache.sling.api.SlingHttpServletRequestgetRequest()Returns the request declared in the context.org.apache.sling.api.resource.ResourceResolvergetResolver()Returns the resolver declared in the context.org.apache.sling.api.resource.ResourcegetResource()Returns the resource declared in the context.org.apache.sling.api.SlingHttpServletResponsegetResponse()Returns the response declared in the context.voidsetAttribute(String name, Object value, BeanContext.Scope scope)Stores an attribute in the context in th given scope.BeanContext.MapwithResource(org.apache.sling.api.resource.Resource resource)Returns a clone of this context with the resource overridden, orthisif it already had this resource.-
Methods inherited from class com.composum.sling.core.BeanContext.AbstractScriptContext
getScriptHelper, getServices, getSlingBindings, retrieveService
-
Methods inherited from class com.composum.sling.core.BeanContext.AbstractContext
adaptTo, cloneContext, getLocale, getService, getType, tryToInstantiateSlingBean, typeFits, withLocale
-
-
-
-
Method Detail
-
getResource
public org.apache.sling.api.resource.Resource getResource()
Description copied from interface:BeanContextReturns the resource declared in the context.
-
getResolver
public org.apache.sling.api.resource.ResourceResolver getResolver()
Description copied from interface:BeanContextReturns the resolver declared in the context.
-
getRequest
public org.apache.sling.api.SlingHttpServletRequest getRequest()
Description copied from interface:BeanContextReturns the request declared in the context.
-
getResponse
public org.apache.sling.api.SlingHttpServletResponse getResponse()
Description copied from interface:BeanContextReturns the response declared in the context.
-
getAttribute
public <T> T getAttribute(String name, Class<T> T)
Description copied from interface:BeanContextReturns an attribute value from the context.
-
setAttribute
public void setAttribute(String name, Object value, BeanContext.Scope scope)
Description copied from interface:BeanContextStores an attribute in the context in th given scope.
-
withResource
public BeanContext.Map withResource(org.apache.sling.api.resource.Resource resource)
Description copied from interface:BeanContextReturns a clone of this context with the resource overridden, orthisif it already had this resource. All other internal structures of this will be referenced by the copy, too.- Parameters:
resource- the resource- Returns:
- a context with the
BeanContext.getResource()resource, everything else (except possibly resolver) unchanged. Might bethis.
-
-