commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andres Almiray (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LANG-274) Support for multidimensional array conversion
Date Tue, 25 Jul 2006 21:00:14 GMT
    [ http://issues.apache.org/jira/browse/LANG-274?page=comments#action_12423455 ] 
            
Andres Almiray commented on LANG-274:
-------------------------------------

Henry,

There is a facade, ConvertUtils, that works very similar to its counterpart on beanutils.
All the converters extend the Converter interface, but that is just a marker interface, the
convert method of each implementation is intended to be invoked by reflection or by direct
type manipulation, because the primitive converters return a primitive value, not a wrapper.
The array converters depend on the primitive ones.
Another advantage of the primitive converters is that they accept Number, String and they
respective wrapper as inputs.
In the end, a user just needs to know about ConverterUtils and that Converter implementations
hava a convert( Object value ) method (by convention) that returns the correct value. 

I believe the other project is commons-convert, still on sandbox since 2005.

I'll be very happy to provide a patch using the json-lib code as a starting base. An option
that comes to mind is refactor the current toPrimitive/toObject methods so they delegate the
work to the specific arrayConverter. And maybe add a general array conversion for Number[]
and String[].

Please let me know what you think of this approach.

> Support for multidimensional array conversion
> ---------------------------------------------
>
>                 Key: LANG-274
>                 URL: http://issues.apache.org/jira/browse/LANG-274
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Andres Almiray
>            Priority: Minor
>
> Only unidimenisional array conversions are supported by ArrayUtils. I recently had the
new for this and seeing that Lang does not support the feature, I hacked it myself (please
see json-lib's <a href="http://json-lib.cvs.sourceforge.net/json-lib/json-lib/">cvs</a>/<a
href="http://json-lib.sourceforge.net/apidocs/net/sf/json/converter/package-frame.html">javadoc</a>
for reference). I think that this feature may be useful to others and that json-lib is not
the correct project for it.
> This issue is at the boundaries between lang and beanutils. Lang allows the conversion
of an unidimensional array between wrappers and primitives. BeanUtils allows conversion from
String to unidimensional arrays. As BeanUtils is more fragile then Lang I thought this was
the correct place to post the issue.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message