You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (Jira)" <ji...@apache.org> on 2021/06/25 11:12:00 UTC

[jira] [Commented] (SLING-10256) Default value support for ValueMapValue

    [ https://issues.apache.org/jira/browse/SLING-10256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17369409#comment-17369409 ] 

Konrad Windszus commented on SLING-10256:
-----------------------------------------

Default values require more than one element: https://github.com/apache/sling-org-apache-sling-models-api/blob/master/src/main/java/org/apache/sling/models/annotations/Default.java. I don't think we should add all elements to every model-specific injector because it makes handling more complicated, rather than simpler.

> Default value support for ValueMapValue
> ---------------------------------------
>
>                 Key: SLING-10256
>                 URL: https://issues.apache.org/jira/browse/SLING-10256
>             Project: Sling
>          Issue Type: Improvement
>          Components: Sling Models
>            Reporter: noel
>            Priority: Major
>
> Currently, It is possible to set a default value for a ValueMapValue injection by combining it with the 
> {code}
> @Default (values = "standardbuttonwhite")
> {code:java}
> annotation. 
> Since most features moved away from an "additional annotation" approach towards a "parameter" aproach, I would like to suggest to do the same for ValueMapValue defaults
> So instead of
> {code:java}
> @ValueMapValue
> @Default (values = "standardbuttonwhite")
> private String fieldName;
> {code}
> it would be nice if
> {code:java}
> @ValueMapValue(defaults = "standardbuttonwhite")
> private String fieldName;
> {code}
> would be possible



--
This message was sent by Atlassian Jira
(v8.3.4#803005)