[jira] [Created] (CONFIGURATION-453) Set multiple properties at once

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

[jira] [Created] (CONFIGURATION-453) Set multiple properties at once

Gary D. Gregory (Jira)
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 | Threaded
Open this post in threaded view
|

[jira] [Commented] (CONFIGURATION-453) Set multiple properties at once

Gary D. Gregory (Jira)

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

Oliver Heger commented on CONFIGURATION-453:
--------------------------------------------

Yes, this could be useful. Which concrete API or method signature do you suggest?

> 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 | Threaded
Open this post in threaded view
|

[jira] [Commented] (CONFIGURATION-453) Set multiple properties at once

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

    [ 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 | Threaded
Open this post in threaded view
|

[jira] [Commented] (CONFIGURATION-453) Set multiple properties at once

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

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

Alexander Prishchepov commented on CONFIGURATION-453:
-----------------------------------------------------

I was thinking along:
---------------------
Configuration.setProperties(Map)
---------------------

I have a configuration with costly write operation.
Calling setProperty(...) in cycle takes some time.

I think DatabaseConfiguration would also benefit from it. Like CONFIGURATION-180

> 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 | Threaded
Open this post in threaded view
|

[jira] [Commented] (CONFIGURATION-453) Set multiple properties at once

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

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

Alexander Prishchepov commented on CONFIGURATION-453:
-----------------------------------------------------

On second thought - there are methods:
{noformat}
load()
reload()
save()
{noformat}
in FileConfiguration. Some kind of CachedConfiguration interface would probably be more generic.

> 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