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

Amit Jain updated OAK-1857:
---------------------------
    Fix Version/s:     (was: 1.1)
                   1.1.0

> Support collection object conversion to String[] in ConfigurationParameters
> ---------------------------------------------------------------------------
>
>                 Key: OAK-1857
>                 URL: https://issues.apache.org/jira/browse/OAK-1857
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: core
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>            Priority: Minor
>             Fix For: 1.1.0
>
>         Attachments: OAK-1857.patch
>
>
> {{ConfigurationParameters}} currently only converts simple type to the 
> desired target type. For array type if the object value type matches the 
> target type then it is returned otherwise an error is thrown
> In OSGi configuration its possible that a multi value property is returned as 
> array or collection [1]. To support such case we should try to convert a 
> value to String[] from collection also
> In particular following case should pass
> {code}
>     @Test
>     public void testCollectionAsArray() throws Exception{
>         String[] testArray = {"t"};
>         ConfigurationParameters options = 
> ConfigurationParameters.of(Collections.singletonMap("test", 
> Arrays.asList(testArray)));
>         assertArrayEquals(testArray, options.getConfigValue("test", null, 
> String[].class));
>     }
> {code}
> [1] http://www.osgi.org/javadoc/r2/org/osgi/service/cm/Configuration.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to