Author: buildbot Date: Fri Mar 24 12:04:32 2017 New Revision: 1008906 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 Fri Mar 24 12:04:32 2017 @@ -1 +1 @@ -1788400 +1788419 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 Fri Mar 24 12:04:32 2017 @@ -693,9 +693,12 @@ injectors in <a href="http://svn.apache. <h1 id="specifying-an-alternate-adapter-class-since-110">Specifying an Alternate Adapter Class (since 1.1.0)<a class="headerlink" href="#specifying-an-alternate-adapter-class-since-110" title="Permanent link">¶</a></h1> <p>By default, each model class is registered using its own implementation class as adapter. If the class has additional interfaces this is not relevant.</p> <p>The <code>@Model</code> annotations provides an optional <code>adapters</code> attribute which allows specifying under which type(s) the model -implementation should be registered in the Models Adapter Factory. With this property it is possible to register the model +implementation should be registered in the Models Adapter Factory. Prior to <em>Sling Models Impl 1.3.10</em> only the given class names +are used as adapter classes, since 1.3.10 the implementation class is always being registered implicitly as adapter as well (see <a href="https://issues.apache.org/jira/browse/SLING-6658">SLING-6658</a>). +With this attribute it is possible to register the model to one (or multiple) interfaces, or a superclass. This allows separating the model interface from the implementation, which makes it easier to provide mock implementations for unit tests as well.</p> +<p>Prior to Sling Models 1.3.10 by default the model is only registered to the ones given in <code>adapters</code> if there. Since 1.3.10</p> <p>Example:</p> <div class="codehilite"><pre><span class="nd">@Model</span><span class="o">(</span><span class="n">adaptables</span> <span class="o">=</span> <span class="n">Resource</span><span class="o">.</span><span class="na">class</span><span class="o">,</span> <span class="n">adapters</span> <span class="o">=</span> <span class="n">MyService</span><span class="o">.</span><span class="na">class</span><span class="o">)</span> <span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyModel</span> <span class="kd">implements</span> <span class="n">MyService</span> <span class="o">{</span> @@ -791,7 +794,7 @@ model, exported as a <code>java.lang.Str </pre></div> </td></tr></table> <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;"> - Rev. 1783973 by kwin on Wed, 22 Feb 2017 07:41:19 +0000 + Rev. 1788419 by kwin on Fri, 24 Mar 2017 12:04:14 +0000 </div> <div class="trademarkFooter"> Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project