Sling Models

Post on 11-Apr-2017

135 views 1 download

Transcript of Sling Models

Sling Models

Why Models● Pure POJO’s● Retrieve all things sling (ValueMap, Sling

bindings, OSGI services and request attributes)

● Adapt from all things sling (Resource, ValueMap, SlingHttpServletRequest…)

● Supports classes and interfaces

Adapting Models

Models and Properties

Special Injection

What Can be Injected?JCR Structure

Injecting Sling Objects

What about Constructors?

What if I don’t like Injection?

● Prefix all property retrievals with “model”

Drawbacks

You may be thinking...

Implications● Unified interaction with components

regardless of context (from JSP, Service, Mordor)

● Easy interaction between components in Java land

Component Interaction