[ https://issues.apache.org/jira/browse/SLING-5992?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Justin Edelson updated SLING-5992: ---------------------------------- Attachment: SLING-5992.patch In an offline conversation with [~radu.cotescu], we determined that another use case for adding the resourceType attributes to the @Model annotation was to use this information in an ImplementationPicker so that if there were multiple model classes registered with the same interface, the "nearest" implementation to the associated resource type could be returned. I created a new ImplementationPicker with a ranking of MAX_INTEGER - 1 which handles this case. > Provide a way to map Sling Model classes to resource types > ---------------------------------------------------------- > > Key: SLING-5992 > URL: https://issues.apache.org/jira/browse/SLING-5992 > Project: Sling > Issue Type: New Feature > Components: Extensions > Reporter: Justin Edelson > Fix For: Sling Models API 1.3.0, Sling Models Impl 1.3.0 > > Attachments: SLING-5992.patch > > > For ease of script development, I would like to introduce a mechanism for > mapping Sling Model classes to resource types for Resource and > SlingHttpServletRequest objects. > From an API perspective, this introduces two new methods on ModelFactory: > {code} > public Object getModelFromResource(@Nonnull Resource resource); > public Object getModelFromRequest(@Nonnull SlingHttpServletRequest request); > {code} > And a new attribute on the @Model annotations > {code} > public String resourceType() default ""; > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)