You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bu...@apache.org on 2016/11/03 04:43:39 UTC

svn commit: r1000415 - in /websites/staging/sling/trunk/content: ./ documentation/bundles/models.html

Author: buildbot
Date: Thu Nov  3 04:43:39 2016
New Revision: 1000415

Log:
Staging update by buildbot for sling

Modified:
    websites/staging/sling/trunk/content/   (props changed)
    websites/staging/sling/trunk/content/documentation/bundles/models.html

Propchange: websites/staging/sling/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Nov  3 04:43:39 2016
@@ -1 +1 @@
-1767468
+1767818

Modified: websites/staging/sling/trunk/content/documentation/bundles/models.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/bundles/models.html (original)
+++ websites/staging/sling/trunk/content/documentation/bundles/models.html Thu Nov  3 04:43:39 2016
@@ -145,6 +145,8 @@ h2:hover > .headerlink, h3:hover > .head
 </ul>
 </li>
 <li><a href="#specifying-an-alternate-adapter-class-since-sling-models-110">Specifying an Alternate Adapter Class (Since Sling Models 1.1.0)</a></li>
+<li><a href="#associating-a-model-class-with-a-resource-type-since-sling-models-130">Associating a Model Class with a Resource Type (Since Sling Models 1.3.0)</a></li>
+<li><a href="#exporter-framework-since-sling-models-130">Exporter Framework (Since Sling Models 1.3.0)</a></li>
 </ul>
 </div>
 <p>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.</p>
@@ -506,6 +508,8 @@ Validation is only supported on models w
 <dd>set default values for a field or method</dd>
 <dt><code>@Path</code></dt>
 <dd>only used together with the resource-path injector to specify the path of a resource</dd>
+<dt><code>@Exporters</code>/<code>@Exporter</code>/<code>@ExporterOptions</code>/<code>@ExporterOption</code></dt>
+<dd>See Exporter Framework section below</dd>
 </dl>
 <p>In addition all <a href="#injector-specific-annotations">injector-specific annotations</a>.</p>
 <h1 id="available-injectors">Available Injectors<a class="headerlink" href="#available-injectors" title="Permanent link">&para;</a></h1>
@@ -704,8 +708,16 @@ ordered alphabetically by the class name
 SPI interface which could use context to determine which implementation can be chosen, e.g. depending an a tenant or
 content path context. If multiple implementations of the <code>ImplementationPicker</code> interface are present, they are queried
 one after another in order of their service ranking property, the first one that picks an implementation wins.</p>
+<h1 id="associating-a-model-class-with-a-resource-type-since-sling-models-130">Associating a Model Class with a Resource Type (Since Sling Models 1.3.0)<a class="headerlink" href="#associating-a-model-class-with-a-resource-type-since-sling-models-130" title="Permanent link">&para;</a></h1>
+<p>The <code>@Model</code> annotation provides an optional <code>resourceType</code> attribute which allows for model classes to be associated with one or
+more resource types. This is used in three different ways.</p>
+<p>In the case of multiple model classes implementing the same interface, the class with the "closest" resource type will be used when
+adapting to the interface.</p>
+<p>The <code>ModelFactory</code> service interface has methods <code>Object getModelFromResource(Resource)</code> and <code>Object getModelFromRequest(SlingHttpServletRequest)</code> which will dynamically determine the adapter class based on the <code>Resource</code> using its type. In the case of the <code>SlingHttpServletRequest</code> method, it uses the request's <code>Resource</code> object (i.e. by calling <code>request.getResource()</code>)</p>
+<p>The resource type is also used as part of the Exporter framework (see next section).</p>
+<h1 id="exporter-framework-since-sling-models-130">Exporter Framework (Since Sling Models 1.3.0)<a class="headerlink" href="#exporter-framework-since-sling-models-130" title="Permanent link">&para;</a></h1>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1743654 by kwin on Fri, 13 May 2016 11:23:07 +0000
+        Rev. 1767818 by justin on Thu, 3 Nov 2016 04:43:21 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project