Author: kwin
Date: Thu May 21 08:25:05 2015
New Revision: 1680762

URL: http://svn.apache.org/r1680762
Log:
clarify how injector sling-object works

Modified:
    sling/site/trunk/content/documentation/bundles/models.mdtext

Modified: sling/site/trunk/content/documentation/bundles/models.mdtext
URL: 
http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/models.mdtext?rev=1680762&r1=1680761&r2=1680762&view=diff
==============================================================================
--- sling/site/trunk/content/documentation/bundles/models.mdtext (original)
+++ sling/site/trunk/content/documentation/bundles/models.mdtext Thu May 21 
08:25:05 2015
@@ -86,8 +86,9 @@ Or
 
 As with other AdapterFactories, if the adaptation can't be made for any 
reason, `adaptTo()` returns null.
 ## ModelFactory (since 1.2.0)
+*See also  [SLING-3709](https://issues.apache.org/jira/browse/SLING-3709)*
 
-Since Sling Models 1.2.0 
([SLING-3709](https://issues.apache.org/jira/browse/SLING-3709)) there is 
another way of instantiating models. The OSGi service `ModelFactory` provides a 
method for instantiating a model that throws exceptions this is not possible. 
That way `null` checks are not necessary.
+Since Sling Models 1.2.0 there is another way of instantiating models. The 
OSGi service `ModelFactory` provides a method for instantiating a model that 
throws exceptions. This is not allowed by the Javadoc contract of the adaptTo 
method. That way `null` checks are not necessary and it is easier to see why 
instantiation of the model failed.
 
     ::java
        try {
@@ -366,9 +367,9 @@ Value Map          | `valuemap`
 Child Resources    | `child-resources`       | 3000                | 1.0.0     
                               | Gets a child resource by name | `Resource` 
objects | no | none | if a parameterized type is passed, a `List<Resource>` is 
returned (the contents of which may be adapted to the target type).
 Request Attributes | `request-attributes`    | 4000                | 1.0.0     
                               | Get a request attribute       | 
`ServletRequest` objects | no | no conversion is done | If a parameterized type 
is passed, the request attribute must be of a compatible type of the 
parameterized type.
 OSGi Services      | `osgi-services`         | 5000                | 1.0.0     
                               | Lookup services based on class name | Any 
object | yes | yes | Parameterized `List` and `Collection` injection points are 
injected by getting an array of the services and creating an unmodifiable 
`List` from the array.
-Resource Path      | `resource-path`         | 2500                | 1.1.0     
                               | Injects a resource by its path. | `Resource` 
or `SlingHttpRequest` objects | yes | none | none
+Resource Path      | `resource-path`         | 2500                | 1.1.0     
                               | Injects a resource by its path. | `Resource` 
or `SlingHttpServletRequest` objects | yes | none | none
 Self               | `self`                  | `Integer.MAX_VALUE` | 1.1.0     
                               | Injects the adaptable object itself (if the 
class of the field matches or is a supertype). If the @Self annotation is 
present it is tried to adapt the adaptable to the field type.  | Any object | 
yes | none | none
-Sling Object       | `sling-object`          | `Integer.MAX_VALUE` | 1.1.0     
                               | Injects commonly used sling objects if the 
field matches with the class: request, response, resource resolver, current 
resource, SlingScriptHelper | `Resource`, `ResourceResolver` or 
`SlingHttpRequest` objects | yes | none | none
+Sling Object       | `sling-object`          | `Integer.MAX_VALUE` | 1.1.0     
                               | Injects commonly used sling objects if the 
field matches with the class: request, response, resource resolver, current 
resource, SlingScriptHelper. This works only if the adaptable can get the 
according information, i.e. all objects are available via 
`SlingHttpServletRequest` while `ResourceResolver` can only resolve the 
`ResourceResolver` object and nothing else | `Resource`, `ResourceResolver` or 
`SlingHttpServletRequest` objects | yes | none | none
 
 # Injector-specific Annotations (Since Sling Models Impl 1.0.6)
 


Reply via email to