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 2016/11/03 04:43:21 UTC

svn commit: r1767818 - /sling/site/trunk/content/documentation/bundles/models.mdtext

Author: justin
Date: Thu Nov  3 04:43:21 2016
New Revision: 1767818

URL: http://svn.apache.org/viewvc?rev=1767818&view=rev
Log:
started work on Sling Models 1.3.0 doc

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=1767818&r1=1767817&r2=1767818&view=diff
==============================================================================
--- sling/site/trunk/content/documentation/bundles/models.mdtext (original)
+++ sling/site/trunk/content/documentation/bundles/models.mdtext Thu Nov  3 04:43:21 2016
@@ -359,6 +359,9 @@ Injectors are invoked in order of their
 `@Path`
 :   only used together with the resource-path injector to specify the path of a resource
 
+`@Exporters`/`@Exporter`/`@ExporterOptions`/`@ExporterOption`
+:   See Exporter Framework section below
+
 In addition all [injector-specific annotations](#injector-specific-annotations).
 
 # Available Injectors
@@ -434,4 +437,19 @@ It is possible to have multiple models i
 ordered alphabetically by the class name. Applications can provide an OSGi service implementing the `ImplementationPicker`
 SPI interface which could use context to determine which implementation can be chosen, e.g. depending an a tenant or
 content path context. If multiple implementations of the `ImplementationPicker` interface are present, they are queried
-one after another in order of their service ranking property, the first one that picks an implementation wins.
\ No newline at end of file
+one after another in order of their service ranking property, the first one that picks an implementation wins.
+
+# Associating a Model Class with a Resource Type (Since Sling Models 1.3.0)
+
+The `@Model` annotation provides an optional `resourceType` attribute which allows for model classes to be associated with one or
+more resource types. This is used in three different ways.
+
+In the case of multiple model classes implementing the same interface, the class with the "closest" resource type will be used when
+adapting to the interface.
+
+The `ModelFactory` service interface has methods `Object getModelFromResource(Resource)` and `Object getModelFromRequest(SlingHttpServletRequest)` which will dynamically determine the adapter class based on the `Resource` using its type. In the case of the `SlingHttpServletRequest` method, it uses the request's `Resource` object (i.e. by calling `request.getResource()`)
+
+The resource type is also used as part of the Exporter framework (see next section).
+
+# Exporter Framework (Since Sling Models 1.3.0)
+