You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Oliver Heger (JIRA)" <ji...@apache.org> on 2013/08/24 22:00:52 UTC

[jira] [Resolved] (CONFIGURATION-26) Consider returning a concatenation of the list properties with getString()

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

Oliver Heger resolved CONFIGURATION-26.
---------------------------------------

    Resolution: Fixed

While the requested feature is still not supported out of the box, it is now possible to achieve the desired effect by using a custom {{ConversionHandler}}.

Each configuration object is now associated with a {{ConversionHandler}} object. The conversion handler is responsible for all kinds of data type conversions. This includes conversions from complex objects (like arrays or lists) to single values. Here a custom {{ConversionHandler}} implementation can hook in to return a verbatim string value or whatever it sees appropriate.

There is already a default implementation called {{DefaultConversionHandler}} which offers some protected methods a subclass may override to adapt conversions. The user's guide was updated to describe these new features.
                
> Consider returning a concatenation of the list properties with getString()
> --------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-26
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-26
>             Project: Commons Configuration
>          Issue Type: Bug
>            Reporter: Ittay Dror
>            Priority: Minor
>             Fix For: 2.0
>
>
> in AbstractConfiguration.resolveContainerStore (javadoc):
>   * Returns an object from the store described by the key. If the value is a
>   * List object, replace it with the first object in the list.
> but what if getProperty returns a List because this is the type of the property? 
>  this code will silently grab the first elemen. I don't understand why. Probably 
> the reason is that some class extending AbstractConfiguration returns List for 
> properties. In this case I think the better approach is to have that class 
> return the first element instead, rather than returning the List and letting 
> AbstractConfiguration (which is used by many other implementations, including 
> outside of the configuration package) handle it

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira