On Mon, Feb 16, 2004 at 10:14:43PM +0100, Sylvain Wallez wrote:
Tim Larson wrote:[Note: This should have read: "private final".]
I would like to make the WidgetDefinition objects be "static final", so
the compiler can help us respect the definitions by preventing us from changing them in ways that are not thread-safe.Uh? Can you elaborate on why some definitions could be not thread-safe? AFAIK, once configured, the widget definitions serve only as factories.
Example definition which sports a non-thread-safe method: formmodel/FieldDefinition.java: private boolean required; public void setRequired(boolean required); For more examples like this, just look for more setSomething methods in the widget definition classes.
We are careful when we call these set* methods so we have not had
problems, but wouldn't it be nice to let the language help document
and enforce the "configure once, use as a factory thereafter" model?
As I said in my previous post (sorry, not much interactivity as I currently use a dialup connection), wanting removing all modifiers can make the code difficult to write. We should better enforce this through a "makeReadOnly" method.
Another way would be by merging the WidgetDefinitionBuilder into the WidgetDefinition, as has been done for the TreeProcessor in 2.2. I have to think a bit more about this, but it's IMO the way to go (and would remove 1/3 of the classes!)
Sylvain
-- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects } Orixo, the opensource XML business alliance - http://www.orixo.com
