On Nov 14, 2006, at 12:02 PM, Jeremy Boynes wrote:
On 11/14/06, Jim Marino <[EMAIL PROTECTED]> wrote:
>
One minor thing here. Unless the configuration values are always
immutable, an ObjectFactory should be injected otherwise one
component could accidentally modify a configuration parameter of
another as instances will be shared. When the component
implementation instance is created, the AtomicComponent will need to
call all of the ObjectFactory.getInstance methods to retrieve
configuration values that are injected. If the values are mutable,
the ObjectFactory will need to instantiate, copy or clone a value. If
the value is immutable, it can always pass the same one. In part of
the refactors to container.script, I introduced some code that does
this which can be used as an example.
This is really to protect against accidental (or malicious) alteration
by a user-supplied implementation. I don't think this is necessary
here as we should be able to trust the DAS implementation not to try
and mutate the value.
I would strongly recommend it since code has a habit of getting
copied and in user-supplied implementations we shouldn't be so
trustworthy. An ObjectFactory is still free to make the optimization
of passing back the same immutable property instance :-)
--
Jeremy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]