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
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]
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
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
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
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
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