Package com.composum.sling.core
Interface SlingBean
-
- All Known Implementing Classes:
AbstractServletBean
,AbstractSlingBean
,ResourceModel
,SetupConfiguration
,SetupConfiguration.ConfigBean
,SetupConfiguration.ScriptBean
,UserProfile
public interface SlingBean
The interface for 'Beans' to implement a Model based on e JCR resource without a mapping framework. Such a 'bean' can be declared as variable in a JSP context using the 'component' tag of the Composum 'nodes' tag library (cpnl).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description String
getName()
returns the name of the resource wrapped by this beanString
getPath()
returns the path of the resource wrapped by this beanString
getType()
returns the type of the resource wrapped by this beanvoid
initialize(BeanContext context)
Deprecated.please useBeanContext.adaptTo(Class)
with the needed SlingBean class to instantiate the object, sinceinitialize(BeanContext)
doesn't initialize fields injected by Sling-Models.void
initialize(BeanContext context, org.apache.sling.api.resource.Resource resource)
Deprecated.please useBeanContext.withResource(Resource)
.BeanContext.adaptTo(Class)
with the needed SlingBean class to instantiate the object, sinceinitialize(BeanContext, Resource)
doesn't initialize fields injected by Sling-Models.
-
-
-
Method Detail
-
initialize
@Deprecated void initialize(BeanContext context, org.apache.sling.api.resource.Resource resource)
Deprecated.please useBeanContext.withResource(Resource)
.BeanContext.adaptTo(Class)
with the needed SlingBean class to instantiate the object, sinceinitialize(BeanContext, Resource)
doesn't initialize fields injected by Sling-Models.This basic initialization sets up the context and resource attributes only, all the other attributes are set 'lazy' during their getter calls.You might want to consider using
initialize(BeanContext)
afterBeanContext.withResource(Resource)
, which should be the same thing.- Parameters:
context
- the scripting context (e.g. a JSP PageContext or a Groovy scripting context)resource
- the resource to use (normally the resource addressed by the request)- See Also:
BeanContext.withResource(Resource)
-
initialize
@Deprecated void initialize(BeanContext context)
Deprecated.please useBeanContext.adaptTo(Class)
with the needed SlingBean class to instantiate the object, sinceinitialize(BeanContext)
doesn't initialize fields injected by Sling-Models.Uses the context for initialization - must call the 'main' initialization - initialize(context,resource) - with the resource determined from the context.- Parameters:
context
- the scripting context (e.g. a JSP PageContext or a Groovy scripting context)
-
getName
String getName()
returns the name of the resource wrapped by this bean
-
getPath
String getPath()
returns the path of the resource wrapped by this bean
-
getType
String getType()
returns the type of the resource wrapped by this bean
-
-