Jan 28th, 2007, 10:51 AM
create immutable objects with factories?
i have an object tree, which is all immutable objects meaning, the constructors do all the work. the object are being populated from xml (not using xml schema, the xml i'm getting is rather hmmm.. odd) each object is getting one Xml element object extracts data using xpath to it's variables.
now the element itself always contains a attribute called TypeId which contains a number , this number alone can help me decide which class to create, i was wondering if there is someway to externlize this map of numbers to class types aside form using my own reflection of constructros.
Jan 30th, 2007, 11:50 AM
Have you looked at the custom schema support (http://www.springframework.org/docs/...ble-xml.html)? In any case where there is a large number of similar beans to create this can help enormously. I don't think there is any reason in principle why this would not be applicable, but you might have to modify the XML to ensure that your schema can be found (you might be able to do this dynamically, I haven't tried it).
Feb 4th, 2007, 11:49 AM
i believe there is something misunderstanding here, if i'm i got you correctly i think i'm using a static xml which i wish to use as bean factory,what i'm getting is xml of actuall data, which i should read and turn into data objects tree.
(actually i have no idea how can i test methods with junit which return objects).