[ 
https://issues.apache.org/jira/browse/SLING-6652?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15929541#comment-15929541
 ] 

Dirk Rudolph commented on SLING-6652:
-------------------------------------

Thanks for the patch, that definitively make sense, but there is one point I 
want to highlight again. In 

ModelPackageBundleListener l162 and l164 you still implicitly require the first 
{{adapterType}} to be the relevant one for the {{ExportServlet}} which isn't 
always true, so

* we can either document that somewhere
* or register each {{@Model}} having {{@Exporter}} set implicitly with its 
{{implType}} as {{adapterType}}, if not already present there.

I prefer the second option because,

* users of {{@Model#adapters}} have not yet been aware of the adapter's order 
being relevant
* there is anyway a strong 1:1 relation between the {{@Exporter}} and the class 
annotated with it
* the documentation would belong to {{@Model#adapters}}, which would cross 
reference unimported {{@Exporter}} then

Maybe it also makes sense to register each {{@Model}} with its {{implType}} 
implicitly, if not explicitly given, wdyt?

> Allow multiple adapters for Models with resourceType binding
> ------------------------------------------------------------
>
>                 Key: SLING-6652
>                 URL: https://issues.apache.org/jira/browse/SLING-6652
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>    Affects Versions: Sling Models Impl 1.3.0
>            Reporter: Dirk Rudolph
>         Attachments: SLING-6652.diff
>
>
> According to 
> http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/AdapterImplementations.java?view=markup#l59
>  the AdapterImplementations support only mapping resourceType to Adapter 1:1. 
> I would like to propose extending that to support 1:n binding between 
> resourceType and adapter classes.
> My use case: 
> Lets assume I want to combine my models with the exporter framework to export 
> 2 representations of a single resource:
> * metadata
> * data
> To do so I would create 2 models, each bound to the same resourceType but 
> annotated to be exported for different selectors. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to