On 11/20/2013 2:21 PM, Eugen Paraschiv wrote:
Quick question about the HttpSolrServer implementation - I would like to
extend some of the functionality of this class - but when I extend it - I'm
having issues with how extensible it is.
For example - some of the details are not visible externally - setters
exist for maxRetries and followRedirects but no getters.
It would really help to make this class a bit more extensible - I'm sure it
usually enough, but when it does need to be extended - it would make sense
to allow that rather than the client implement alternative version of it
via copy-paste (which looks like the only option available right now).

The specific examples that you have given are things that typically get set when the object is created and neverget changed. If you really need access to maxRetries or other things that are private but have no getter, you can implement local fields, pass-through setters, and the getters you want.At the URL below, you can see an implementation that exposes a getter for maxRetries and has no warnings. This will allow you to expose internal details that are not available upstream:

http://apaste.info/70Jh

For followRedirects, this is a parameter for the HttpClient. There is a getter for the HttpClient, and with that, you can look up and change just about anything you want.

A question for java experts and committers with a lot of experience ... are there compelling reasons to keep so many details in HttpSolrServer private rather than protected? Should getters be implemented for all private fields?

Thanks,
Shawn

Reply via email to