Friday 24 June 2016

Use Sling Model with Sightly in AEM

Sling Models
Many Sling projects want to be able to create model objects – POJOs which are automatically mapped from Sling objects, typically resources, but also request objects. Sometimes these POJOs need OSGi services as well.

In simple terms Sling Models are simple POJO classes which are mapped automatically with Sling Objects (resource, request objects..) and allow us to access jcr node property values directly into java classes.


Advantages of using Sling Models
  • Pure POJO classes.
  • Entirely annotation driven(Need to write less code).
  • Can adapt multiple objects –  – minimal required Resource and SlingHttpServletRequest OOTB, support resource properties (via ValueMap), SlingBindings, OSGi services, request attributes
  • Support both classes and interfaces.
  • Plugabble.
  •  Work with existing Sling infrastructure (i.e. not require changes to other bundles).


No comments :

Post a Comment