[jira] Created: (SLING-662) ValueMap#get(java.lang.String name, T defaultValue) should support arrays transparently

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (SLING-662) ValueMap#get(java.lang.String name, T defaultValue) should support arrays transparently

Robert Munteanu (Jira)
ValueMap#get(java.lang.String name, T defaultValue) should support arrays transparently
---------------------------------------------------------------------------------------

                 Key: SLING-662
                 URL: https://issues.apache.org/jira/browse/SLING-662
             Project: Sling
          Issue Type: Improvement
          Components: JCR Resource
            Reporter: Tobias Bocanegra


when calling ValueMap.get("name", String[].class) and empty array is returned if the underlying jcr property is not
multivalued. this is very inconvenient.

imo get() for arrays or single values should work transparently regardless of the underlying property multivalueness.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Reply | Threaded
Open this post in threaded view
|

[jira] Assigned: (SLING-662) ValueMap#get(java.lang.String name, T defaultValue) should support arrays transparently

Robert Munteanu (Jira)

     [ https://issues.apache.org/jira/browse/SLING-662?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger reassigned SLING-662:
---------------------------------------

    Assignee: Felix Meschberger

> ValueMap#get(java.lang.String name, T defaultValue) should support arrays transparently
> ---------------------------------------------------------------------------------------
>
>                 Key: SLING-662
>                 URL: https://issues.apache.org/jira/browse/SLING-662
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR Resource
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>
> when calling ValueMap.get("name", String[].class) and empty array is returned if the underlying jcr property is not
> multivalued. this is very inconvenient.
> imo get() for arrays or single values should work transparently regardless of the underlying property multivalueness.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (SLING-662) ValueMap#get(java.lang.String name, T defaultValue) should support arrays transparently

Robert Munteanu (Jira)
In reply to this post by Robert Munteanu (Jira)

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

Felix Meschberger commented on SLING-662:
-----------------------------------------

Sounds reasonable, indeed.

> ValueMap#get(java.lang.String name, T defaultValue) should support arrays transparently
> ---------------------------------------------------------------------------------------
>
>                 Key: SLING-662
>                 URL: https://issues.apache.org/jira/browse/SLING-662
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR Resource
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>
> when calling ValueMap.get("name", String[].class) and empty array is returned if the underlying jcr property is not
> multivalued. this is very inconvenient.
> imo get() for arrays or single values should work transparently regardless of the underlying property multivalueness.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (SLING-662) ValueMap#get(java.lang.String name, T defaultValue) should support arrays transparently

Robert Munteanu (Jira)
In reply to this post by Robert Munteanu (Jira)

     [ https://issues.apache.org/jira/browse/SLING-662?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved SLING-662.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: JCR Resource 2.0.4

Committed an ehancement in Rev. 696291 as follows:

* If the property is multivalue and the type is an array an array of converted values is returned
* If the property is multivalue with at least one value and the type is not an array, the first value is returned
* If the property is multivalue with no values, null is returned
* If the property is single-value and the type is an array a single element array is returned
* If the property is single-value and the type is not an array, the converted value is returned

Please close this issue, if this is ok for you. Thanks.

> ValueMap#get(java.lang.String name, T defaultValue) should support arrays transparently
> ---------------------------------------------------------------------------------------
>
>                 Key: SLING-662
>                 URL: https://issues.apache.org/jira/browse/SLING-662
>             Project: Sling
>          Issue Type: Improvement
>          Components: JCR Resource
>            Reporter: Tobias Bocanegra
>            Assignee: Felix Meschberger
>             Fix For: JCR Resource 2.0.4
>
>
> when calling ValueMap.get("name", String[].class) and empty array is returned if the underlying jcr property is not
> multivalued. this is very inconvenient.
> imo get() for arrays or single values should work transparently regardless of the underlying property multivalueness.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.