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

Reply via email to