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


##########
src/main/jbake/content/documentation/bundles/models.md:
##########
@@ -89,40 +83,13 @@ Constructor injection is also supported (as of Sling Models 
1.1.0):
 
 Because the name of a constructor argument parameter cannot be detected via 
the Java Reflection API a `@Named` annotation is mandatory for injectors that 
require a name for resolving the injection.
 
-Constructors may use any visibility modifier (as of [Sling Models 
1.5.0](https://issues.apache.org/jira/browse/SLING-8069)):
+Constructors may use any visibility modifier (as of [Sling Models 
1.5.0](https://issues.apache.org/jira/browse/SLING-8069)).
 
-    ::java
-    @Model(adaptables=Resource.class)
-    public class PublicConstructorModel {    
-        @Inject
-        public PublicConstructorModel() {
-          // constructor code
-        }
-    }
+## @Model and adaptable types
 
-    @Model(adaptables=Resource.class)
-    public class ProtectedConstructorModel {    
-        @Inject
-        protected ProtectedConstructorModel() {
-          // constructor code
-        }
-    }
+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. All injectors also 
support adaption from a `SlingHttpServletRequest` object, but normally this is 
then converted into a adaption of the resource of the request. The only 
exception on the default injectors is the "Request Attribute" injector, which 
requires that the model is adapted from a SlingHttpServletRequest.

Review Comment:
   is refined.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to