commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver.He...@t-online.de (Oliver Heger)
Subject [convert]Another use case
Date Fri, 05 Mar 2004 19:19:47 GMT
Shortly ago there was a discussion in [configuration] about adding 
further data types to the Configuration interface. This interface 
already allows to retrieve properties in many different data types, but 
still additional types are requested (e.g. Locale, URL, ...). As is 
quite obvious, this is a data conversion issue rather than a 
configuration issue.

The idea was to limit the Configuration interface to the most important 
data types and provide a kind of data type conversion service that can 
be wrapped arround a Configuration object and supports a richer 
interface with additional data types. This service can be quite generic 
and not configuration specific. Because the [convert] project deals with 
data type conversion it seems to be a good starting place.

What I have in mind is the following:

- An interface defining a conversion source, which could look as follows:
public interface ConversionSource {
  Object getProperty(Object key, Object defaultValue);
}

- A class that can be instantiated with such a conversion source as 
argument. This class would define a couple of getter methods for 
properties with different data types. Internally such a getter would 
fetch the properties from the conversion source object, perform the 
necessary conversion and return the result (or throw an exception).

Different implementations of the ConversionSource interface would allow 
usage of the conversion service whereever nasty data type conversions 
are needed, e.g. for Configuration objects, servlet request parameters 
or whatever.

What do you think of this approach? If I provided some patches for this 
feature, would somebody be willing to apply them?

BTW, what is the actual status of the [convert] project (I had trouble 
when building the latest CVS version; two unit tests fail)?

Regards
Oliver


---------------------------------------------------------------------
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