You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Henri Yandell <ba...@generationjava.com> on 2003/10/08 05:20:53 UTC

[convert] initial code commit

Code now committed to commons-sandbox. There's also an object diagram in
the xdocs directory.

{braindump}
I've got a CollectionsConverter which currently does not pass tests. Not
sure it's finished either. So not committed yet.

The ArrayConverter ought to replace all the array converters in BeanUtils,
so it might be worth committing to BeanUtils if nothing comes of
[convert].

I dumped the old ConvertUtils and ConvertUtilsBean and coded from scratch.
ConvertRegistry is the name for my replacement, which acts solely as an
instance. No attempts to be bean-like or to act as a special static thing.
Those may be tacked on later on.

Currently it uses inheritence for both fromClass and toClass. Recent mail
on the list explain why I think it's bad for toClass.

The string sub-package is a direct copy of BeanUtils, with the array ones
removed.

//H? and // TODO are both notations I use to indicate questions/todos.

You need the project.xml I just commited to the sandbox top level to
build using Maven. No ant build as yet.

I've ignored Locale concepts and default values to keep things simpler.
{/braindump}

Apologies for playing with this on my own for a week. I was having fun :)

Hen


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


Re: [convert] initial code commit

Posted by "Craig R. McClanahan" <cr...@apache.org>.
Henri Yandell wrote:

>You need the project.xml I just commited to the sandbox top level to
>build using Maven. No ant build as yet.
>  
>
The former requirement doesn't cause me any grief.  The later is an 
absolute prerequisite if you would like nightly builds produced like we 
do for the other commons and sandbox packages.  Fortunately, it's fairly 
easy to create such a thing:  "maven ant:generate-build" and then check 
in the corresponding build.xml file.

>I've ignored Locale concepts and default values to keep things simpler.
>
Locale concepts are the only thing that makes conversion issues even 
mildly interesting :-).

>{/braindump}
>
>Apologies for playing with this on my own for a week. I was having fun :)
>
>Hen
>  
>
Craig



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


Re: [convert] initial code commit

Posted by Stephen Colebourne <sc...@btopenworld.com>.
I would have a look at the Joda typeconvertors.

They concentrate on Object->String and String->Object. Add Object-Object
later if anyone really needs it.

They also have a mechanism for dealing with superclass/subclass
relationships. You can register a TypeConvertorFactory that creates
TypeConvertors for subclasses of a specified type. This is necessary for
enumerated types, where they all fulfil the same interface and you don't
want a specific convertor coded for each enum.

So, the registry starts with a combination of a map of known convertors for
specific classes (no inheritance lookup), and a map of factories by
supertype (with inheritance lookup). The first time a factory is invoked,
the resulting convertor is placed into the first map, thus speeding up
subsequent lookups.

Stephen


----- Original Message -----
From: "Henri Yandell" <ba...@generationjava.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Wednesday, October 08, 2003 4:36 AM
Subject: Re: [convert] initial code commit


>
> To save people effort, the design doc is:
>
>
http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/convert/xdocs/convert.
png?rev=HEAD&content-type=text/vnd.viewcvs-markup
>
> Hen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


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


Re: [convert] initial code commit

Posted by Henri Yandell <ba...@generationjava.com>.
To save people effort, the design doc is:

http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/convert/xdocs/convert.png?rev=HEAD&content-type=text/vnd.viewcvs-markup

Hen


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