sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r985907 - in /websites/staging/sling/trunk/content: ./ documentation/bundles/models.html
Date Sun, 17 Apr 2016 06:09:37 GMT
Author: buildbot
Date: Sun Apr 17 06:09:37 2016
New Revision: 985907

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 Sun Apr 17 06:09:37 2016
@@ -1 +1 @@
-1739323
+1739545

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 Sun Apr 17 06:09:37
2016
@@ -232,7 +232,7 @@ can be listed in a comma-separated list
 <p><em>See also  <a href="https://issues.apache.org/jira/browse/SLING-3709">SLING-3709</a></em></p>
 <p>Since Sling Models 1.2.0 there is another way of instantiating models. The OSGi
service <code>ModelFactory</code> provides a method for instantiating a model
that throws exceptions. This is not allowed by the Javadoc contract of the adaptTo method.
That way <code>null</code> checks are not necessary and it is easier to see why
instantiation of the model failed.</p>
 <div class="codehilite"><pre><span class="k">try</span> <span
class="o">{</span>
-    <span class="n">MyModel</span> <span class="n">model</span> <span
class="o">=</span> <span class="n">modelFactory</span><span class="o">.</span><span
class="na">createModel</span><span class="o">(</span><span class="n">resource</span><span
class="o">,</span> <span class="n">MyModel</span><span class="o">.</span><span
class="na">class</span><span class="o">);</span>
+    <span class="n">MyModel</span> <span class="n">model</span> <span
class="o">=</span> <span class="n">modelFactory</span><span class="o">.</span><span
class="na">createModel</span><span class="o">(</span><span class="n">object</span><span
class="o">,</span> <span class="n">MyModel</span><span class="o">.</span><span
class="na">class</span><span class="o">);</span>
 <span class="o">}</span> <span class="k">catch</span> <span class="o">(</span><span
class="n">Exception</span> <span class="n">e</span><span class="o">)</span>
<span class="o">{</span>
     <span class="c1">// give out error message that the model could not be instantiated.
</span>
     <span class="c1">// The exception contains further information. </span>
@@ -702,7 +702,7 @@ SPI interface which could use context to
 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>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1726211 by kwin on Fri, 22 Jan 2016 13:50:22 +0000
+        Rev. 1739545 by olli on Sun, 17 Apr 2016 06:09:19 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project



Mime
View raw message