You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Kris Nuttycombe <Kr...@noaa.gov> on 2004/10/14 21:15:56 UTC

[beanutils] Generifying the Converter interface

I'm just starting to play around with generics, and thought that 
org.apache.commons.beanutils.Converter might be an interesting candidate 
for generification. A good generified converter library is broadly 
useful outside of BeanUtils.

Here's my first thought on generifying the Converter interface:

public interface Converter<I,O>{
    /**
     * Convert the specified input object into an output object of the
     * specified type.
     *
     * @param type Data type to which this value should be converted
     * @param value The input value to be converted
     *
     * @exception ConversionException if conversion cannot be performed
     *  successfully
     */
    public O convert(Class<O> type, I value);
}

Comments, suggestions?

Kris

-- 
=====================================================
Kris Nuttycombe
Associate Scientist
Geospatial Data Services Group
CIRES, National Geophysical Data Center/NOAA
(303) 497-6337
Kris.Nuttycombe@noaa.gov
=====================================================



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


Re: [beanutils] Generifying the Converter interface

Posted by Stephen Colebourne <sc...@btopenworld.com>.
FYI, there is a sandbox project [convert] that I tried to setup to be a
dedicted converter project. I ran out of time, so it never got completed,
but you may want to take a look.

Note that JDK1.5 compilation is going to cause issues to commons in general.

Stephen

----- Original Message -----
From: "Kris Nuttycombe" <Kr...@noaa.gov>
> I'm just starting to play around with generics, and thought that
> org.apache.commons.beanutils.Converter might be an interesting candidate
> for generification. A good generified converter library is broadly
> useful outside of BeanUtils.
>
> Here's my first thought on generifying the Converter interface:
>
> public interface Converter<I,O>{
>     /**
>      * Convert the specified input object into an output object of the
>      * specified type.
>      *
>      * @param type Data type to which this value should be converted
>      * @param value The input value to be converted
>      *
>      * @exception ConversionException if conversion cannot be performed
>      *  successfully
>      */
>     public O convert(Class<O> type, I value);
> }
>
> Comments, suggestions?
>
> Kris
>
> --
> =====================================================
> Kris Nuttycombe
> Associate Scientist
> Geospatial Data Services Group
> CIRES, National Geophysical Data Center/NOAA
> (303) 497-6337
> Kris.Nuttycombe@noaa.gov
> =====================================================
>
>
>
> ---------------------------------------------------------------------
> 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