hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Defining preferences using properties
Date Thu, 14 Sep 2006 18:11:44 GMT
On Thu, 2006-09-14 at 18:53 +0100, sebb wrote:
> On 14/09/06, Oleg Kalnichevski <olegk@apache.org> wrote:
> > On Thu, 2006-09-14 at 18:09 +0100, sebb wrote:
> [...]
> 
> > > There could be an additional "_type" property for values that aren't
> > > Strings. e.g.
> > >
> > > http.socket.timeout=1000
> > > _type.http.socket.timeout=Integer
> > >
> > > Some conversions might be trickier than others...
> > >
> >
> > It just thought that a map of parameter names to a corresponding
> > instance of java.beans.PropertyEditor might be the most elegant solution
> > to this problem.
> >
> > Map paramEditorMap = new HashMap();
> > paramEditorMap.put("type.http.socket.timeout", new IntegerEditor());
> >
> 
> Not sure I understand how to use the IntegerEditor() here - I thought
> the PropertyEditor classes were intended for GUIs only?
> 

Sun messed up big time by having made java.beans.PropertyEditor
dependent on some AWT interfaces. Nonetheless, this does make property
editors less useful and certainly does not prevent you from using them
in a non-visual mode to convert beans to their textual representation
and back. For instance, Spring makes a very heavy use of property
editors.

> Also, this means knowing all the (non-String) property names in
> advance, even if they are not needed...

Personally I would rather have it this way than have to specify the
parameter type in the config file.

Anyways, take it for what it is worth

Cheers

Oleg


> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
> 


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


Mime
View raw message