On 15 December 2010 09:34, Oleg Kalnichevski <[email protected]> wrote: > On Tue, 2010-12-14 at 22:25 +0000, sebb wrote: >> I've now committed a version of the HttpParams hierarchy using the new >> HttpParamsSet interface. >> I chose to stay with entrySet(), rather than iterator(), as that gives >> a bit more flexibility. >> >> The key question is: do we actually want to keep this new interface? >> [If not, it's easy enough to remove] >> >> If so, is the current API OK? >> > > I personally would prefer to have an interface that returns a set of > parameter names instead of a set of Map.Entry-s.
Which could be done by returning keySet() instead of entrySet() in the case of BasicHttpParams. The public method could be called getNames(). > The existing interface > exposes too much of implementation details to my liking. HttpParams is defined in terms of name-value pairs. The normal way to model that is a Map, and the entrySet() follows naturally from that. So I don't see how it exposes implementation details. > Another benefit > of using a set of parameter names would be that stacked HttpParams > implementations (such as DefaultedHttpParams) could return a joint set > of all parameters present in the hierarchy. That is a good point. It would be harder to do this using entrySet(). Given that retrieving all the values is not performance critical, I would be happy with names only, i.e. add a getNames() method instead of entrySet() In the case of DefaultedHttpParams, I think the local names should also be made available, e.g. through a method such as getLocalNames(). But the default getNames() should include all names. The default names can be easily extracted using getDefaults().getNames(). Though I do wonder why the getDefaults() method is present: given that defaults are supposed to be immutable, it seems odd to expose the field and thus permit updates to it. Perhaps the method should be deprecated? Or maybe the method should return an immutable view of the defaults? > I can live with the interface in its present form, though, if you prefer > it this way. > > One kind request, though. Could you please remove reference to > AbstractHttpParams from DefaultedHttpParams#entrySet() javadocs? Oops - fixed. > Cheers > > Oleg > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
