You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xbean-dev@geronimo.apache.org by "Benjamin Bentmann (JIRA)" <ji...@apache.org> on 2008/10/14 13:15:44 UTC

[jira] Created: (XBEAN-112) Allow conversion from File, URL, Number etc. to String

Allow conversion from File, URL, Number etc. to String
------------------------------------------------------

                 Key: XBEAN-112
                 URL: https://issues.apache.org/jira/browse/XBEAN-112
             Project: XBean
          Issue Type: Improvement
          Components: reflect
    Affects Versions: 3.4.2
            Reporter: Benjamin Bentmann


Values of type {{File}}, {{URL}}, {{Integer}} etc. can naturally be converted to strings. However, the {{ObjectRecipe}} currently blows up if one passes such objects into a string-typed property. 

Some background on the motivation: The property values are not be provided via an XML configuration, i.e. are not natively represented as strings, but are instead retrieved from some expression evaluator that (reflectively) queries a property value from some other bean. If those expressions deliver a non-string-typed value, they can't be injected into a string-typed field. This is pity given that a mere invocation of {{toString()}} does the trick and for instance allows to pass a filesystem path into a String field regardless whether the path happens to be represented by a {{String}} or a {{File}} object.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (XBEAN-112) Allow conversion from File, URL, Number etc. to String

Posted by "Benjamin Bentmann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/XBEAN-112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Bentmann updated XBEAN-112:
------------------------------------

    Attachment: XBEAN-112.patch

Proposed patch.

> Allow conversion from File, URL, Number etc. to String
> ------------------------------------------------------
>
>                 Key: XBEAN-112
>                 URL: https://issues.apache.org/jira/browse/XBEAN-112
>             Project: XBean
>          Issue Type: Improvement
>          Components: reflect
>    Affects Versions: 3.4.2
>            Reporter: Benjamin Bentmann
>         Attachments: XBEAN-112.patch
>
>
> Values of type {{File}}, {{URL}}, {{Integer}} etc. can naturally be converted to strings. However, the {{ObjectRecipe}} currently blows up if one passes such objects into a string-typed property. 
> Some background on the motivation: The property values are not be provided via an XML configuration, i.e. are not natively represented as strings, but are instead retrieved from some expression evaluator that (reflectively) queries a property value from some other bean. If those expressions deliver a non-string-typed value, they can't be injected into a string-typed field. This is pity given that a mere invocation of {{toString()}} does the trick and for instance allows to pass a filesystem path into a String field regardless whether the path happens to be represented by a {{String}} or a {{File}} object.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.