Hey Roy,

Couple of Assumptions:

For the Self resource you have it defined as:

@Self
public Resource resource;

and for the @Model you have something like
@Model(adaptables = RoysCustomDecorator.class)

Am I close?

-Jason

-----Original Message-----
From: Roy Teeuwen [mailto:r...@teeuwen.be] 
Sent: Tuesday, June 06, 2017 10:08 AM
To: users@sling.apache.org
Subject: Sling models - Resource decorator

Hey all,

I am using sling models version 1.2.2, and I have the following logic:

- I find some resources with the resource resolver 
(resourceResolver.findResources)
- The returned resources are the correct resources which are decorated by my 
custom resource decorator
- I iterate the list to cast them to the sling model I want them to be, using a 
resource.adaptTo
- The sling model itself has a field Resource resource, to inject itself

What I notice now is that the injected resource is a JcrNodeResource and not my 
decorated resource class anymore. I guess this is a bug in the sling models 
implementation? Am I doing something wrong here or is this an actual bug in the 
sling models implementation? Is this maybe already fixed in any of the future 
versions?

Greets,
Roy

Reply via email to