Hi Thanks for your email. I always thought that mapping file is required for classes which are not castor generated and yet required to use benefits castor comes bundled with. Does it mean, that no matter how you generate your classes, in order the do the UNMARSHALLING correct, I must a write mapping file? This requires an update anytime any structure hierarchy changes. Is there an utility that can create a mapping file for me based on Castorbuilder.properties? Let me know if this is a good idea - Rather than writing/generating a mapping file, wrap castor unmarshaller into MyUnmarshaller, which reads the nsmappings from castorbuilder.properties and call addNamespaceToPackage that many times on unmarshaller. Sorry too many questions ... -Praveen
Werner Guttmann <[EMAIL PROTECTED]> wrote: Praveen Jani wrote: > Does this mean that castorbuilder.properties is only used for class > generations and not used while unmarshalling. Yes, correct. > Because I have the > namespace to package mapping in castorbuilder.properties. > > Could you please point me to documentation about the mapping file > required for base/super class specification? Have a look at http://www.castor.org/xml-mapping.html#3.-The-Mapping-File in general, and the section that describes the mapping in particular. E.g. the element has an optional extends attribute that allows you to specify parent child relationships, etc, Regards Werner > > Regards, > -Praveen > > */Werner Guttmann /* wrote: > > Please see inline .... > > Amit M Bhosle wrote: > > Hi: > > > > i'm a newbie to castor, and couldn't get things to work for the > > following use case.. would be grateful if some one could help me with > > this.. > > > > here's a simplified version of my use case.. > > i have 2 classes (say, A1, A2), which have a common abstract base > class, > > B.. > > > > my producer class generates some instances of the subclasses, and > > calls a method with the signature > > > > void consume(B b); > > > > on the consumer.. the consume method, on the other hand, looks at the > > runtime class of the argument, and delegates to a specific method.. > > > > void consume(B b){ > > if(b.getClass() == A1.class){ > > consumeA1((A1)b); > > } > > else{ > > consumeA2((A2)b); > > } > > } > > > > the producer and consumer are sitting in different JVMs, and the data > > objects are marshalled (by my communication framework) on the client > > side, transferred over the wire, unmarshalled on server side, and > > passed as the argument to the Consumer.consume method.. > > > > 1. can castor help me with this marshalling/unmarshalling without > > having to use a mapping-file. > Before trying to answer this, I'd like to understand as to why you do > *not* want to use a mapping file. Basically, all advanced features are > exposed through mainly the mapping file. > > > from what i read about castor, i need > > to specify the exact subclass for unmarshalling.. and in my case, i > > don't know the exact subclass at the time of unmarshalling.. > That's definitely not correct. Castor definitely does support > polymorphism. Basically, as defined in the XML standrad itself, Castor > knows how to make use of the xsi:type attribute to express subtype > relationships. > > > 2. can castor help me with a mapping-file? i understand that one > > solution is to write a mapping file defining the mappings for all > > concrete classes.. but i was looking at avoiding that.. the > > auto-naming doesn't seem to work for top-level abstract classes.. > Inheritance without a mapping file will almost be impossible without a > mapping file. You are going to need some construct to express the fact > that a class A is a child of another class. > > > > thanks in advance.. > > regards, > > Amit > > > > --------------------------------------------------------------------- > > To unsubscribe from this list please visit: > > > > http://xircles.codehaus.org/manage_email > > > > > --------------------------------------------------------------------- > To unsubscribe from this list please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email

