Re: Flexible adaptable not resulting in instantiation of correct model

2019-07-08 Thread Liam C
Thanks Vlad, Julian, Paul, for your input. @Julian - yes, that was my interpretation of the situation, confirmed by the fact that adaptation of such adaptables works when the SlingModelsUseProvider has been shut down. Paul's implementation looks good to me - I hope it'll be included in Sling

Re: Flexible adaptable not resulting in instantiation of correct model

2019-06-12 Thread Paul Bjorkstrand
Reading this thread (and looking at the code) I agree with Julian - it is surprising that it does not work with the SlingModelsUseProvider, since it used to work with the JavaUseProvider. This piqued my interest, so I created a minimal implementation of this in [1]. [1]

Re: Flexible adaptable not resulting in instantiation of correct model

2019-06-12 Thread Julian Sedding
Hi Liam Based on the fact that the @Self injection should provide a Resource object, I assume your model is adaptable from a Resource (it would help to provide the class including its @Model annotation). The way this feature is implemented, I assume that it does not work for adapting Resource

Re: Flexible adaptable not resulting in instantiation of correct model

2019-06-12 Thread Vlad Bailescu
Hi Liam, AFAIK, the mentioned pattern is not designed to work with Sling Models. It simply uses the adaptTo pattern to transform the adaptable to the given class. Best, Vlad On Tue, Jun 11, 2019 at 9:00 PM Liam C wrote: > Hello, > > Is anyone able to replicate this, or to confirm that they

Re: Flexible adaptable not resulting in instantiation of correct model

2019-06-11 Thread webmaster
Hello, Is anyone able to replicate this, or to confirm that they have been able to get something similar to { 'com.example.ModelClass' @ adaptable=item} working in their projects, please? Failing this, is there some workaround that could be used within Sightly/HTL to adapt a specified resource

Re: Flexible adaptable not resulting in instantiation of correct model

2019-06-11 Thread Liam C
Hello, Is anyone able to replicate this, or to confirm that they have been able to get something similar to { 'com.example.ModelClass' @ adaptable=item} working in their projects, please? Failing this, is there some workaround that could be used within Sightly/HTL to adapt a specified resource

Flexible adaptable not resulting in instantiation of correct model

2019-04-01 Thread Liam C
Hello everyone, In SLING-6504 (https://issues.apache.org/jira/browse/SLING-6504), functionality was added to allow adapting a resource that is different to the underlying page resource. Feike Visser's example