Carsten Ziegeler created SLING-3451:
---------------------------------------
Summary: Support for deep reads from a value map
Key: SLING-3451
URL: https://issues.apache.org/jira/browse/SLING-3451
Project: Sling
Issue Type: Improvement
Components: API
Reporter: Carsten Ziegeler
When writing rendering code, a commonly used shortcut is to do deep reads to
get properties from a child resource, like:
ValueMap vm = ResourceUtil.getValueMap(resource);
vm.get("jcr:content/jcr:title", "No title found");
While this works with jcr backed resources, this doesn't work in the general
case and a value map returned by a resource should not support this. In
addition, the implementation in the jcr resource bundle is wrong as it bypasses
all resource mechanisms, e.g. in the above case
resource.getChild("jcr:content") might return a resource from a different
resource provider etc.
Adding the same code over and over again in each ValueMap implementation
doesn't look like a good solution either.
The simplest solution would be to enhance ResourceUtil.getValueMap() to return
a wrapper of the value map which allows deep reads.
--
This message was sent by Atlassian JIRA
(v6.2#6252)