On Tue, 2005-12-20 at 18:10 +0100, Valerio Schiavoni wrote:
> Hello Marco,
> i've already considered that option, but it looks quite poor design to
> provide so many setXXX methods on objects that will be initialized once and
> forever.
> Further, there are no restrictions to call those set methods after the
> initialization of the object (that is, after the 0-param constructor is
> used, either via a addObjectCreate or using addFactoryCreate), apart from
> self-disciplined programmers.
> 
> What I mean is: how can I istantiate 'immutable' objects  that requires
> values in their constructors ? None of the examples I found illustrate this
> situation, so maybe this is voluntarly not supported by api designers. if
> so, it'be interesting to understand why.

the digester api is small and simple: digester fires rules when patterns
are matched in the xml being parsed. 

digester ships with a number of standard rules for common use cases.
these have been accumulated over the years. the presence or absence of
rules from this standard set has more to do with what rules developers
have created and contributed to apache than any great design. 

digester can do what you want but AFAIK there is no standard rule
suitable for your exact problem (if anyone knows of one, please jump
in). FactoryCreateRule can be used when the required initialization
parameters are contained in attriutes.

you can easily solve your particular problem by creating a custom rule.
if you feel like contributing a more general solution that can be
included in the standard rules, let me know and i'll outline a design.

- robert


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to