<mapping name="analysis" class="AbstractFunction"
marshaller="AnalysisMapper" unmarshaller="AnalysisMapper"/>
<mapping name="equation" class="?????????" extends="AbstractFunction">
marshaller="EquationMapper" unmarshaller="EquationMapper"/>
There are many different AbstractFunction subclasses that map to <analysis> elements.
There are three different kinds of equations (AbstractFunction subclasses) that map to
the <equation> element. If I use "AbstractFunction" as the class for the equation
mapping, I get a conflicting mapping error when compiling the binding. On the other
hand, if I don't specify a class for the mapping, I get a missing attribute error.
The only way I could think of to get it to work is to create a thin Equation class
that is abstract and extends AbstractFunction -- so all the equation types subclass
this instead of AbstractFunction. There is no other purpose for this Equation class
though, so it's sortof clutter. Is there an alternative?
Thanks,
Eric Moody
>Hi Eric,
>
> If I"m understanding you correctly I don"t think there"s anything to
> prevent you from doing what you want. JiBX marshaller/unmarshallers
> generated from a binding definition only deal with a single element, but
> if you"re writing a custom marshaller/unmarshaller I can"t think of any
> reason you couldn"t have it handle multiple elements. You could specify
> your marshaller/unmarshaller as handling AbstractFunction, but the
> actual type returned by the unmarshaller (or passed to the marshaller)
> could be any subclass of AbstractFunction.
>
> Does that answer your question?
>
> - Dennis
>
> EXT-Moody, Eric W wrote:
>
>I am trying to map multiple tags to a single class. I have an AbstractFunction
>class, a
small number InternalFunction types, and a large/growing number of UserFunction types
that I
can identify by package name (but I will not necessarily know the actual class names in
advance).
>
>So in:
>
> <internal-function>...</internal-function>
> <user-function>...</user-function>
>
>Both of these elements should be handled by the mapper in AbstractFunction. I
>understand
why I can"t specify different marshallers/unmarshallers, but I don"t see any obvious
reason
why this shouldn"t be possible. The custom mapper can decide at runtime which object
type to
create when unmarshalling, and which element type to create when marshalling.
>
>Do I need to use a <structure> element somehow in my binding definition? Is there a
>way to
accomplish this? Perhaps this is a newbie question, but I couldn"t find anything
covering
this specifically, either in the documentation or mailing list.
>
>Thanks,
>Eric Moody
>
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users