DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34103>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34103





------- Additional Comments From [EMAIL PROTECTED]  2005-03-22 08:08 -------
ok, here's my suggestion of how Configuration should be modeled.

The basic methods will be:
   Object getProperty(String key) throws PropertyDoesNotExistException;

   Object getProperty(String key, Object default) throws ConversionException;

   Object getProperty(String key, Class cls) throws
PropertyDoesNotExistException, ConversionException;

   Object getProperty(String key, Converter conv) throws
PropertyDoesNotExistException, ConversionException;

   Object getProperty(String key, Object default, Converter conv) throws
ConversionException;
(the exceptions can/should be RuntimeExceptions, or other exceptions, like
NoSuchElementException)

all the rest of the getXXX() methods are syntactic sugar, one-liners that call
one of the getProperty() methods (second and third forms).

Converter has the API: convert(Objec o, Class cls) to convert o to an instance
of cls. converters can be registered as converting to some class (which is what
getProperty(key,cls) uses.

that's it, simple (the client needs to know only of the first 2 forms if he is
not interested in sophisticated conversions, and the return values are very
consistent, no need to read the documentation for each getXXX() method), yet
powerful (allowing me, for example, to convert a property to Map, Date etc. very
easily)

note that most of the implementation will be in getProperty(key, default,
converter) while the rest just call it (sometimes checking containsKey() before)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

Reply via email to