You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2016/12/08 07:20:57 UTC
svn commit: r1773192 -
/sling/site/trunk/content/documentation/bundles/models.mdtext
Author: kwin
Date: Thu Dec 8 07:20:57 2016
New Revision: 1773192
URL: http://svn.apache.org/viewvc?rev=1773192&view=rev
Log:
clarify array/collection handling
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=1773192&r1=1773191&r2=1773192&view=diff
==============================================================================
--- sling/site/trunk/content/documentation/bundles/models.mdtext (original)
+++ sling/site/trunk/content/documentation/bundles/models.mdtext Thu Dec 8 07:20:57 2016
@@ -179,7 +179,7 @@ OSGi services can be injected:
In this case, the name is not used -- only the class name.
## Collections
-Lists and arrays are supported:
+Lists and arrays are supported by some injectors. For the details look at the table given in [Available Injectors](#available-injectors):
::java
@Model(adaptables=Resource.class)
@@ -189,7 +189,7 @@ Lists and arrays are supported:
private List<Servlet> servlets;
}
-List injection for child resources works by injecting grand child resources (since Sling Models Impl 1.0.6). For example, the class
+List injection for *child resources* works by injecting grand child resources (since Sling Models Impl 1.0.6). For example, the class
::java
@Model(adaptables=Resource.class)
@@ -374,7 +374,7 @@ Title | Name (for `@Source
----------------- | ----------------------- | ------------------- | ---------------------------------------- | ------------ | -------------------------------------- | ------------------ | ------------- | --------------------------
Script Bindings | `script-bindings` | 1000 | 1.0.0 | Lookup objects in the script bindings object by name. | A ServletRequest object which has the `Sling Bindings` attribute defined | no | no conversion is done | If a parameterized type is passed, the bindings value must be of a compatible type of the parameterized type.
Value Map | `valuemap` | 2000 | 1.0.0 | Gets a property from a `ValueMap` by name. | Any object which is or can be adapted to a `ValueMap`| no | Primitive arrays wrapped/unwrapped as necessary. Wrapper object arrays are unwrapped/wrapped as necessary. | Parameterized `List` and `Collection` injection points are injected by getting an array of the component type and creating an unmodifiable `List` from the array.
-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).
+Child Resources | `child-resources` | 3000 | 1.0.0 | Gets a child resource by name. | `Resource` objects | no | none | if a parameterized type `List` or `Collection` is passed, a `List<Resource>` is returned (the contents of which may be adapted to the target type) filled with all child resources of the resource looked up by the given name.
Request Attributes | `request-attributes` | 4000 | 1.0.0 | Get a request attribute by name. | `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. Since Sling Models Impl 1.2.8 ([SLING-5664](https://issues.apache.org/jira/browse/SLING-5664)) the service with the highest service ranking is returned. In case multiple services are returned, they are ordered descending by their service ranking (i.e. the one with the highest ranking first). | 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 one or multiple resources. The resource paths are either given by `@Path` annotations, the element `path` or `paths` of the annotation `@ResourcePath` or by paths given through a resource property being referenced by either `@Named` or element `name` of the annotation `@ResourcePath`. | `Resource` or `SlingHttpServletRequest` objects | yes | yes | none