Hey,
Alright, I just managed to make the first instantiation and invocation
of a Composite with the new refactoring and all I can say is: OMG OMG
OMG OMG!!!
Using all the design patterns suggested so far the whole thing has
shrunk to a zen-like state. I routinely added getters for a lot of state
as I built it, but they are being removed as I realize that much of
external use could be replaced with a business-method in the model
instead. Here is, for example, the invoke method of a Composite instance
upon InvocationHandler.invoke():
return compositeModel.invoke(mixins, proxy, method, args, moduleInstance);
CompositeModel.invoke is then:
return compositeMethodsModel.invoke( mixins, proxy, method, args,
moduleInstance );
CompositeMethodsModel.invoke is then:
CompositeMethodModel compositeMethod = methods.get( method );
if (compositeMethod != null)
{
return compositeMethod.invoke(proxy, args, mixins, moduleInstance);
}
else
return null; // TODO handle Object methods
CompositeMethod.invoke is then:
CompositeMethodInstance methodInstance = getInstance(moduleInstance);
return composite().mixins().invoke(composite, args, mixins, methodInstance);
MixinsModel.invoke is then:
return methodInstance.invoke( composite, args,
mixins[methodIndex.get(methodInstance.getMethod())]);
CompositeMethodInstance.invoke is then currently slightly too
complicated to put here, but I think that will be changed as I update it
to this style as well. The code is now muuuuch easier to follow and it
is easier to see where to do what.
Kewl.
/Rickard
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev