The reason I needed access to internal details of the class - and it's not just these 2 fields (I used these just as a quick example) - was that I was trying to extend the class and overload the request method. As soon as I tried to do that, I noticed that I really couldn't easily do so - because much of the fields has no getters and were not protected either (as you pointed out). So - it's not specifically about this to particular fields - it's more about the overall extensibility of the class. The class is very closed off in terms of the API - so it stands to reason that it may be extended for some specific usecases (for example I am trying to allow setting custom HTTP Headers on the GET request before sending it) - this is mainly why I was asking if it would make sense to try to open it up a little and make it more extensible. Hope that makes sense. Cheers, Eugen.
On Thu, Nov 21, 2013 at 12:21 AM, Shawn Heisey <s...@elyograg.org> wrote: > 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 > >