You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Emmanuel Bourg <e....@cross-systems.com> on 2003/12/16 11:55:47 UTC

[configuration] Extending the Map interface

While implementing the ReloadableConfiguration i had to add a clear() 
method to the Configuration interface. That made me think that a 
Configuration is basically a Map with convenient accessor methods and 
casting the values to the desired type. So what about extending Map in 
the Configuration interface ? That would make sense since Configuration 
is defined as an extended Properties, and Properties implements Map.

Emmanuel Bourg


RE: [configuration] Extending the Map interface

Posted by Eric Pugh <ep...@upstate.com>.
[configuration] Extending the Map interfaceI can't remember where I read
about it, but I think that we are usin Composition versus inheritance..  If
we did inherit from map, that would be cool, except that then you could pass
a configuration object into all kinds of weird places..   Now, with some it
might work, but with others it might break.  And it means that we can never
inherit from something else..

Maybe instead a better approach would be MappableConfiguration or
MapConfiguration that was a decorator and exposed all those configuration
values as map for places where you wanted to treat the Configuration
interface as a Map...

Eric
  -----Original Message-----
  From: Emmanuel Bourg [mailto:e.bourg@cross-systems.com]
  Sent: Tuesday, December 16, 2003 10:56 AM
  To: Jakarta Commons Developers List
  Subject: [configuration] Extending the Map interface


  While implementing the ReloadableConfiguration i had to add a clear()
  method to the Configuration interface. That made me think that a
  Configuration is basically a Map with convenient accessor methods and
  casting the values to the desired type. So what about extending Map in
  the Configuration interface ? That would make sense since Configuration
  is defined as an extended Properties, and Properties implements Map.

  Emmanuel Bourg