On Sun, Oct 18, 2009 at 12:49 PM, Henri Yandell <flame...@gmail.com> wrote:
> Fair enough on the threading though. I'll move to constructor as I > can't think of anything better. Rambling out loud. Better (for API scaling): enum FooParam { various PARAM options} constructor: Foo(FooParam... fp) { this.options = EnumSet.copyOf(Collections.asList(fp)); } That would work quite nicely to replace all the painful boolean constructor parameters. That leaves us then needing a way to scale this for a single initial parameter: With a recompile, you could have an Object called PARAM and replace it with a FooParam.PARAM later on of type enum:FooParam, but I'm assuming that would be an error at runtime. So for runtime API scaling you would need to set the enum up from the start. Ideally it wants to be in the same class/file though, which means an inner class so you can make it public. So: new Foo(Foo.PARAM.escapingPlus) You could also have a single argument constructor to start with, but again runtime is probably unhappy when you switch (or overload - compile error?) with varargs. Is it a worthwhile pattern to avoid rampant booleanism in a minority of classes? Not convinced. Hen --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org