You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by robert burrell donkin <ro...@blueyonder.co.uk> on 2002/11/21 23:32:43 UTC

[beanutils] how should ConvertUtils.convert(Object value) work...?

hey craig (or any other ConvertUtils experts out there)

i don't know if you had time to take a look at:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14170

in short, the ConvertUtils method 'public static String convert(Object 
value)' doesn't use the registered convertors to perform the object to 
string conversion.

is this is behaviour correct?

- robert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [beanutils] how should ConvertUtils.convert(Object value) work...?

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Saturday, November 30, 2002, at 04:36 PM, Craig R. McClanahan wrote:

>
>
> On Thu, 28 Nov 2002, robert burrell donkin wrote:
>
>> Date: Thu, 28 Nov 2002 19:41:06 +0000
>> From: robert burrell donkin <ro...@blueyonder.co.uk>
>> Reply-To: Jakarta Commons Developers List <commons-
>> dev@jakarta.apache.org>
>> To: Jakarta Commons Developers List <co...@jakarta.apache.org>
>> Subject: Re: [beanutils] how should ConvertUtils.convert(Object value)
>>     work...?
>>
>> On Thursday, November 21, 2002, at 11:09 PM, Craig R. McClanahan wrote:
>>
>>> On Thu, 21 Nov 2002, robert burrell donkin wrote:
>>>
>>>> Date: Thu, 21 Nov 2002 22:32:43 +0000
>>>> From: robert burrell donkin <ro...@blueyonder.co.uk>
>>>> Reply-To: Jakarta Commons Developers List <commons-
>>>> dev@jakarta.apache.org>
>>>> To: Jakarta Commons Developers List <co...@jakarta.apache.org>
>>>> Subject: [beanutils] how should ConvertUtils.convert(Object value)
>>>>     work...?
>>>>
>>>> hey craig (or any other ConvertUtils experts out there)
>>>>
>>>> i don't know if you had time to take a look at:
>>>>
>>>> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14170
>>>>
>>>> in short, the ConvertUtils method 'public static String convert(Object
>>>> value)' doesn't use the registered convertors to perform the object to
>>>> string conversion.
>>>>
>>>> is this is behaviour correct?
>>>
>>> Haven't had a chance to look into this (today's the last day of 
>>> ApacheCon)
>>> but it does sound like a legitimate bug.
>>
>> unless anyone objects, i'll create a fix.
>
> +1.

bit more to this than first met my eye...

the basic idea is that ConvertUtils would perform conversions when getting 
properties as well as setting them. this would mean that the 
getXXXProperty methods in the BeanUtils class would allow custom 
conversions rather than the simple toString() call used at the moment.

the existing convertor interface can be reused

public object convert(java.lang.class type, java.lang.Object value)

by passing in type String.class.

whether existing convertor classes could be used for this all depends on 
how they were written. it seems likely that many won't work very well - 
and some, not at all. we can convert the ones in beanutils but not those 
created by users.

at the moment, ConvertUtils only needs one register for convertors since 
it only converts property setters. if ConvertUtils is going to convert 
getters as well, the question arises whether two separate registers are 
needed, one for setters and one for getters.

one register should be easier to use and should make a little more sense 
from a user perspective. without losing too much flexibility (so long as 
the convertors are well written).

having only one register might cause problems with existing code. if the 
registered convertors don't behaviour reasonably when called to convert 
objects to string, then the existing code would break.

anyone else have any thoughts...?

- robert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [beanutils] how should ConvertUtils.convert(Object value) work...?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 28 Nov 2002, robert burrell donkin wrote:

> Date: Thu, 28 Nov 2002 19:41:06 +0000
> From: robert burrell donkin <ro...@blueyonder.co.uk>
> Reply-To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> Subject: Re: [beanutils] how should ConvertUtils.convert(Object value)
>     work...?
>
> On Thursday, November 21, 2002, at 11:09 PM, Craig R. McClanahan wrote:
>
> > On Thu, 21 Nov 2002, robert burrell donkin wrote:
> >
> >> Date: Thu, 21 Nov 2002 22:32:43 +0000
> >> From: robert burrell donkin <ro...@blueyonder.co.uk>
> >> Reply-To: Jakarta Commons Developers List <commons-
> >> dev@jakarta.apache.org>
> >> To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> >> Subject: [beanutils] how should ConvertUtils.convert(Object value)
> >>     work...?
> >>
> >> hey craig (or any other ConvertUtils experts out there)
> >>
> >> i don't know if you had time to take a look at:
> >>
> >> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14170
> >>
> >> in short, the ConvertUtils method 'public static String convert(Object
> >> value)' doesn't use the registered convertors to perform the object to
> >> string conversion.
> >>
> >> is this is behaviour correct?
> >
> > Haven't had a chance to look into this (today's the last day of ApacheCon)
> > but it does sound like a legitimate bug.
>
> unless anyone objects, i'll create a fix.
>

+1.

> - robert
>

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [beanutils] how should ConvertUtils.convert(Object value) work...?

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
On Thursday, November 21, 2002, at 11:09 PM, Craig R. McClanahan wrote:

> On Thu, 21 Nov 2002, robert burrell donkin wrote:
>
>> Date: Thu, 21 Nov 2002 22:32:43 +0000
>> From: robert burrell donkin <ro...@blueyonder.co.uk>
>> Reply-To: Jakarta Commons Developers List <commons-
>> dev@jakarta.apache.org>
>> To: Jakarta Commons Developers List <co...@jakarta.apache.org>
>> Subject: [beanutils] how should ConvertUtils.convert(Object value)
>>     work...?
>>
>> hey craig (or any other ConvertUtils experts out there)
>>
>> i don't know if you had time to take a look at:
>>
>> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14170
>>
>> in short, the ConvertUtils method 'public static String convert(Object
>> value)' doesn't use the registered convertors to perform the object to
>> string conversion.
>>
>> is this is behaviour correct?
>
> Haven't had a chance to look into this (today's the last day of ApacheCon)
> but it does sound like a legitimate bug.

unless anyone objects, i'll create a fix.

- robert


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [beanutils] how should ConvertUtils.convert(Object value) work...?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 21 Nov 2002, robert burrell donkin wrote:

> Date: Thu, 21 Nov 2002 22:32:43 +0000
> From: robert burrell donkin <ro...@blueyonder.co.uk>
> Reply-To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> Subject: [beanutils] how should ConvertUtils.convert(Object value)
>     work...?
>
> hey craig (or any other ConvertUtils experts out there)
>
> i don't know if you had time to take a look at:
>
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14170
>
> in short, the ConvertUtils method 'public static String convert(Object
> value)' doesn't use the registered convertors to perform the object to
> string conversion.
>
> is this is behaviour correct?
>

Haven't had a chance to look into this (today's the last day of ApacheCon)
but it does sound like a legitimate bug.

> - robert
>

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>