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

Emmanuel Bourg commented on CONFIGURATION-453:
----------------------------------------------

What's the use case for setting multiple properties in one call?


For the method signature, I suggest this:

{code:java}setProperty(Map.Entry<String, Object>... entries){code}

that would give this very nice syntax:

{code:java}
conf.setProperty(new AbstractMap.SimpleEntry<String, Object>("key1", "value1"),
                 new AbstractMap.SimpleEntry<String, Object>("key2", "value2"))
{code}

uh no, forget it ;)

We might as well use a Map:

{code:java}setProperties(Map<String, Object> entries){code}

which gives:

{code:java}
Map entries = new HashMap();
entries.put("key1", "value1");
entries.put("key2", "value2");

conf.setProperties(entries);
{code}

but that's not really simpler than:

{code:java}
conf.setProperty("key1", "value1");
conf.setProperty("key2", "value2");
{code}


I don't think there will be a decent solution until Java has a simple map 
creation syntax like the one proposed by the project Coin:

{code:java}
conf.setProperty({"key1":"value1", "key2":"value2"});
{code}


> Set multiple properties at once
> -------------------------------
>
>                 Key: CONFIGURATION-453
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-453
>             Project: Commons Configuration
>          Issue Type: Improvement
>            Reporter: Alexander Prishchepov
>            Priority: Minor
>
> It might be useful to set multiple properties by one call.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to