commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg (JIRA)" <>
Subject [jira] [Commented] (CONFIGURATION-453) Set multiple properties at once
Date Mon, 20 Jun 2011 09:42:47 GMT


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:

conf.setProperty(new AbstractMap.SimpleEntry<String, Object>("key1", "value1"),
                 new AbstractMap.SimpleEntry<String, Object>("key2", "value2"))

uh no, forget it ;)

We might as well use a Map:

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

which gives:

Map entries = new HashMap();
entries.put("key1", "value1");
entries.put("key2", "value2");


but that's not really simpler than:

conf.setProperty("key1", "value1");
conf.setProperty("key2", "value2");

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:

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

> Set multiple properties at once
> -------------------------------
>                 Key: CONFIGURATION-453
>                 URL:
>             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:


View raw message