You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ju...@apache.org on 2014/01/22 20:28:10 UTC
svn commit: r1560487 -
/sling/site/trunk/content/documentation/bundles/models.mdtext
Author: justin
Date: Wed Jan 22 19:28:10 2014
New Revision: 1560487
URL: http://svn.apache.org/r1560487
Log:
adding table
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=1560487&r1=1560486&r2=1560487&view=diff
==============================================================================
--- sling/site/trunk/content/documentation/bundles/models.mdtext (original)
+++ sling/site/trunk/content/documentation/bundles/models.mdtext Wed Jan 22 19:28:10 2014
@@ -52,7 +52,7 @@ Client code doesn't need to be aware tha
Or
::jsp
- <sling:adaptTo adaptable="${resource}" adaptTo="org.apache.sling.models.it.models.MyModel" var="model"/>
+ <sling:adaptTo adaptable="${resource}" adaptTo="org.apache.sling.models.it.models.MyModel" var="model"/>
Or
::jsp
@@ -211,27 +211,37 @@ When a resource is adapted to `MyModel`,
# Annotation Reference
`@Model`
: declares a model class or interface
+
`@Inject`
: marks a field or method as injectable
+
`@Named`
: declare a name for the injection (otherwise, defaults based on field or method name).
+
`@Optional`
: marks a field or method injection as optional
+
`@Source`
: explictly tie an injected field or method to a particular injector (by name). Can also be on other annotations.
+
`@Filter`
: an OSGi service filter
+
`@PostConstruct`
: methods to call upon model option creation (only for model classes)
+
`@Via`
: use a JavaBean property of the adaptable as the source of the injection
+
`@Default`
: set default values for a field or method
# Available Injectors
-Title Name (for @Source) Description Applicable To (including using @Via) Notes
-Value Map valuemap Gets a property from a Value Map Any object which is or can be adapted to a ValueMap
-OSGI Services osgi-services Lookup services based on class name Any object Effectively ignores name.
-Script Bindings script-bindings Lookup objects in the script bindings object A ServletRequest object which has the Sling Bindings attribute defined
-Child Resources child-resources Gets a child resource by name Resource objects
-Request Attributes request-attributes Get a request attribute ServletRequest objects
+
+Title | Name (for `@Source`) | Description | Applicable To (including using `@Via`) | Notes
+----------------- | ----------------------- | -------- | ------ | -----
+Value Map | valuemap | Gets a property from a Value Map | Any object which is or can be adapted to a ValueMap
+OSGI Services | osgi-services | Lookup services based on class name | Any object | Effectively ignores name.
+Script Bindings |script-bindings | Lookup objects in the script bindings object | A ServletRequest object which has the Sling Bindings attribute defined
+Child Resources | child-resources | Gets a child resource by name | Resource objects
+Request Attributes | request-attributes | Get a request attribute | ServletRequest objects