Announcement Announcement Module
No announcement yet.
create immutable objects with factories? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #2
    Have you looked at the custom schema support ( 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).


    • #3
      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).