[
https://issues.apache.org/jira/browse/SLING-6318?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Justin Edelson updated SLING-6318:
----------------------------------
Attachment: SLING-6318.diff
Here's my first attempt to optimize for this case.
The patch adds an internal-only interface (ValuePreparer) which can be
implemented by Injectors to do some prework (i.e. get the ValueMap for a
Resource) one time per adaptation rather than per-injection point.
For now, this interface (and thus the implementations of it) is internal to the
implementation bundle, so this is only available on 1st party injectors. We can
always move this to the API package later, but I thought it was best to
experiment on our injectors before adding new API.
> Remove repeated retrieval of ValueMap when adapting a model class with
> multiple ValueMap injections
> ---------------------------------------------------------------------------------------------------
>
> Key: SLING-6318
> URL: https://issues.apache.org/jira/browse/SLING-6318
> Project: Sling
> Issue Type: Bug
> Components: Extensions
> Reporter: Justin Edelson
> Fix For: Sling Models Impl 1.3.6
>
> Attachments: SLING-6318.diff
>
>
> In an offline discussion with [~radu.cotescu], he expressed a concern about
> how if you have a model class (or interface) with a number of ValueMap-based
> injections it would end up calling Resource.adaptTo(ValueMap.class) multiple
> times.
> While I think this may be primarily an issue for the Resource implementation
> to solve for, it is true that the effective code executed by Sling Models is
> going to be less efficient in this case than manual construction of the
> object.
> So I think it is worth exploring.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)