I have been reviewing the implementation I submitted for mixin support
in JCR-1100 and am struggling with how to proceed. On the one hand I
think the implementation that was submitted is nice since it has some
amount of type safety and gives the developer the ability to cast
objects. On the other hand, how is a developer to know what to cast
the objects to? I am starting to experiment with using the bean
generator cglib code which will allow me to use regular javabeans. My
idea is that the mapped node type would be used to instantiate the
object and then for mixin properties I would create a new class
dynamically which contains all the mixin's properties. I would modify
the object converter to first create the object with its nodes mapped
properties then I would take each mixin for its node and grab the
attributes for the mixin based on the mixin definition mapped in xml
(not sure how to handle this in JDK 1.5 where the mappings are done
with annotations) and add these attributes to a new class which is a
subclass of the node's defined class. This new class would have
properties defined for each property in the mixin.
Has anyone else thought about how to handle this? Is this really a
need, or should I just go back to using hashmaps (not something I
really like, but....)
-paddy
- [OCM] Dynamic Mixin Support Padraic Hannon
-