1 Feb 2007 09:46
Re: mutability in hivemind 2 registry construction api
Knut Wannheden <knut.wannheden <at> gmail.com>
2007-02-01 08:46:11 GMT
2007-02-01 08:46:11 GMT
Hi Achim, On 1/25/07, Achim Hügen <achim.huegen <at> gmx.de> wrote: > I agree that it is desirable to reduce mutability. > > Most of the collections returned from any definition > class could be made immutable. > A call to Collections.unmodifiableCollection() would solve this. > > Regarding the addXxx methods I find it very helpful to use > the definition classes for construction and extension resolving. > Otherwise one would need an additional structure that represents > the assocations between extension points and extensions and which > is used during construction for resolving and constraint checking. > To my mind it feels like the most natural fit to add and retrieve > the associated objects directly from their source. > When *defining* a module using Java code I agree that using the addXxx() methods may feel more natural so it might make sense to have those in implementation classes. But I don't agree with that this is required for the extension resolving. You say that an additional structure would be required. As I see it this additional structure is already present, it's HiveMind internal counterpart to the definition structure. I.e. the objects Module, ServicePoint, etc. created during the registry construction. And that's also how it worked in HiveMind 1. > These add methods are defined in the public interfaces. > RegistryDefinition#addModule(Continue reading)
On 2/8/07, Massimo Lusetti <mlusetti <at> gmail.com> wrote:
> I'll write codes inline.
> As said this is rally all the needed code to be able to inject
> HiveMind services in a Tapestry5 page/component/service, just add this
> code to your module builder class and use the 'hivemind' prefix for
> reaching your HiveMind services, it will just works.
>
> <at> Contribute("tapestry.ioc.MasterObjectProvider")
> public static void contributeHiveMindToMasterObjectProvider(
> MappedConfiguration<String, ObjectProvider> configuration,
> <at> InjectService("HiveMind")
> ObjectProvider hivemind)
> {
> configuration.add("hivemind", hivemind);
> }
>
>
> public static ObjectProvider buildHiveMind(Log log)
> {
> return new HiveMindObjectProvider(log);
> }
>
>
RSS Feed