WCMUsePojo
|
Sling Models
|
Pure POJO’s(Plain Old Java Objects)
|
Annotation driven POJO’s. The class
uses @Model annotation & fields use the @Inject annotation
|
No default resource mapping
|
Sling Models are mapped automatically with Sling Objects
(resource, request objects..) and allow us to access jcr node property values
directly into java classes.
For Example:
@Inject @Named("sling:resourceType")
protected String resourceType;
|
Always extends from WCMUsePojo class
|
Can be standalone class with
@Model annotation
|
Supports only Classes
|
Support both classes and interfaces.
|
Overrides activate() method
|
init() method is invoked in @PostConstruct
annotation
|
@Reference to reference an OSGi service
|
@Inject or @OSGiService annotation used
|
No Exporter available by default
|
@Exporter annotation can
serialize the model and export it as a JSON file with Jackson exporter
|
Tuesday, March 19, 2019
Sling Models vs WCMUsePojo
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment