Hi,

I've been working on the type conversion lately, it's almost complete, I still have to refactor the unit tests and write the docs. Here is what I plan to commit:

- A new Converter interface is introduced in the o.a.c.c.converter package. This interface has a single method designed to convert a value into any other type:

public interface Converter
{
<T> T convert(Class<T> cls, Object value, Object... params) throws ConversionException;
}


- the DefaultConverter class in the same package provides a default implementation of this interface.

- AbstractConfiguration has a new instance field with get/setters to specify the converter to be used. DefaultConverter is used by default. Another implementation using BeanUtils or Morph can be used instead (I implemented a converter based on BeanUtils as an example but it supports only the String->Object conversion).

- internally, DefaultConverter uses a set of package private type converters to handle the conversion into a specific type (LocaleConverter, DateConverter, etc). The TypeConverter interface looks like this :


interface TypeConverter<T>
{
    T convert(Object value, Object... params) throws ConversionException;
}

- the to<Type>() methods in PropertyConverter are removed. I suggest renaming the class to PropertyUtils to avoid any confusion with the converters.

What do you think?

Emmanuel Bourg


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to