Hi Kevin,

Possibly.  As it stands now, I think it would be a rather large refactoring
> of the Reference class as it does not really support the builder style.
>

Again, if the performance isn't an issue, we could simply implement the
methods this way (+ NPE checks) :

public void addQueryParameter(String name, String value) {
   setQuery(getQuery() + '&' + encode(name) + '=' + encode(value));
}

In addition, we could still add a fluent ReferenceBuilder, which would be
stricter about the ordering but much faster as one single buffer would be
necessary (with a status int flag).

Best regards,
Jerome

Are you confident in your test case(s) for the Reference class should the
> internals be entirely reworked?
>
> Kevin
>
> On Dec 3, 2007 5:01 PM, Jerome Louvel < [EMAIL PROTECTED]> wrote:
>
> >
> > Hi Kevin,
> >
> > > I've created Issue 389 to track this in the future:
> > > http://restlet.tigris.org/issues/show_bug.cgi?id=389
> >
> > Thanks for the complete RFE (patch and test case).
> >
> > > It wasn't my intention to gain any performance from this new
> > > class, merely convenience and ease of use.  I don't think
> > > that building URI strings is a performance problem for most people.
> >
> > In this case, wouldn't it be sufficient to add new methods to the
> > Reference
> > class?
> >  - addQueryParameter(String name, String value)
> >  - addSegment(String segment)
> >  - addMatrixParameter(String name, String value)
> >
> > Also, those methods could return a 'this' pointer to the Reference
> > instance
> > allowing fluent call chaining.
> >
> > > My intention was that the new class be very high level in
> > > terms of building a URI string and I hope that the attached
> > > patch reflects that intention.
> >
> > IMHO, we should first try to enhance the Reference class instead of
> > adding a
> > new one, unless we want to obtain a better performing implementation.
> >
> > Best regards,
> > Jerome
> >
>
>

Reply via email to