On Tue, Jan 19, 2010 at 11:18 AM, Stefan Bodewig <[email protected]> wrote: > On 2010-01-19, Mitch Gitman <[email protected]> wrote: >> It seems that, since the project knows all its listeners to notify >> them of an event, it wouldn't be so hard to add a method to query all >> the listeners for their log level and then return the max of that. The >> build listeners would also need a getter for their log level. > > Note that in order to do that you are going to change interfaces that > are implemented by third parties (there are quite a few BuildListener > implementations out there) who won't be happy if ther code stops > working. > > In the past we've added new interfaces when we added functionality - > like we did for SubBuildListener - in this case using reflection in > order to look for a getLevel method or similar may be more appropriate > than changing the interface. Just thinking out loud as well 8-)
I don't think reflection is necessary. In the spirit of Google's GO language, which flattens type hierarchy, (which in that regard is very reminiscent of COM: read Don Box's first chapter on COM, it's very very good), just define a new separate interface with a getLevel and whatever method, and just QueryInterface (i.e. test instanceof on the listener reference) to get a ref on that new interface (via a cast) to call the method. But that's a pull design where the core would need to ask the listeners for there max log level, and assuming that level can dynamically change, the code would need to ask all the time. A push design where the listener itself calls the core when it changes level is easier IMHO, and thus doesn't need any changes to the listener interface or a new interface. My $0.02. --DD --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
