Request for comments: Bug 6306820
richard at kennardconsulting.com
Tue May 22 18:07:47 PDT 2007
>Do you know if it makes much (or any) difference to JSP applications
>whether objects are created by constructor or by static factory method.
Not really. A lot of the focus on JSPs has already gone from this class (since we moved it from URIBuilder to URIQueryString). It will now mainly be applicable 'behind the scenes' (eg. when implementing JSP tag libraries like c:url)
> Static factory methods are definitely useful
Agreed. Alan has clarified them a bit for me so I'll go ahead and make those changes.
> I also quite like the idea of method chaining
Me too, but my main concern is that it isn't in the 'spirit' of the rest of the JDK? Is method chaining used anywhere else?
> The main question I think is ... whether to expose the implementation map.
The reason I did this was because there were a number of useful scenarios from the original URIBuilder such as...
1. stripping out parameters with certain names, like jsession_id and j_username
2. stripping out parameters with certain values, like empty strings and zeros
...but we agreed these were overkill for many purposes. I was comfortable removing these scenerios only because, by exposing the internal Map via getParameterMap, advanced users could easily 'roll their own'. So, if we don't expose the internal Map we limit these scenerios.
An alternative approach would be to expose a COPY of the internal Map, let the user modify it, and then introduce a setParameterMap method to re-set it. However, the problem there is that, internally, it is important the Map is a LinkedHashMap - so that it maintains the ordering of parameters. At the moment, however, getParameterMap simply returns a Map (eg. it doesn't worry the user with what sort of Map).
However, setParameterMap would not have this luxury: it would have to be setParameterMap( LinkedHashMap ).
So I guess it comes down to what seems less messy? Exposing the internal Map, or exposing the fact that it is a LinkedHashMap?
More information about the net-dev