You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2023/01/03 09:31:46 UTC

[GitHub] [sling-site] joerghoh commented on a diff in pull request #106: SLING-11711 rework of the Sling Model documentation, part 1

joerghoh commented on code in PR #106:
URL: https://github.com/apache/sling-site/pull/106#discussion_r1060403681


##########
src/main/jbake/content/documentation/bundles/models.md:
##########
@@ -85,6 +85,14 @@ Because the name of a constructor argument parameter cannot be detected via the
 
 Constructors may use any visibility modifier (as of [Sling Models 1.5.0](https://issues.apache.org/jira/browse/SLING-8069)).
 
+## @Model and adaptable types
+
+While technically it is possible to provide any class implementing the `Adaptable` interface as the `adaptable` parameter to the `@Model` annotation, the Sling Model Framework and the default injectors is mostly built under the assumption that the adaption is done from a Sling Resource. Some injectors also support adaption from a `SlingHttpServletRequest` object, but normally this is then converted into a adaption of the resource of the request.

Review Comment:
   @kwin: I want to give clear guidelines what to use; and recommending to always use SlingHttpServletRequest sounds incorrect, because then you cannot use it outside of a request, limiting the flexibility.
   
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org