[
https://issues.apache.org/jira/browse/SLING-2779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13601039#comment-13601039
]
Alexander Klimetschek commented on SLING-2779:
----------------------------------------------
Agree with Carsten - the sling:defaults property seems like a too specific
mechanism. You can think of many ways how to get the defaults map, e.g. by
inheritance, certain path naming pattern, shadow paths, even for sling:defaults
you could check for ancestor's sling:defaults... - so we should not bake in one
specific way down in Sling already. (Maybe later if one turns out very common
and useful).
Secondly, the current patch seems it does not support relative paths to
properties of descendants (when a Resource is passed in the constructor for the
defaults). As this generally works with the ValueMap, I think this should work
for defaults as well - I can easily imagine the defaults being a tree as well.
At least there might be an option.
Other than that it makes sense.
> Support for default properties values of a resource
> ---------------------------------------------------
>
> Key: SLING-2779
> URL: https://issues.apache.org/jira/browse/SLING-2779
> Project: Sling
> Issue Type: New Feature
> Components: API
> Affects Versions: API 2.3.0
> Reporter: Gilles Knobloch
> Attachments: DefaultsValueMap.java
>
>
> I already noticed several times it would be useful to be able to specify a
> default properties for a resource:
> * if the resource itself contains the property, it will override the default
> one.
> * but if it doesn't, the default value is used.
> This could be done either via:
> * specifying a {{sling:defaults}} property on the resource, which contains
> the path to the resource which properties will be used by default.
> * providing a default map of properties
> Attaching a patch for review.
> For testing purpose, I put it under {{org.apache.sling.defaults}}, but I
> imagine it could go to {{org.apache.sling.api.resource}}.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira