Hi,

I've stumbled into the following problem that I'm not 100% sure how to
handle.

I have the following situation:

abstract class Foo {

}

class Bar extends Foo {

}

class Boo extends Foo {

}

class Baz {
 private Foo[] fooElements;
}

where fooElements can contain nulls. However, trying to marshal this only
brings nullpointerexceptions.
I read:
http://sourceforge.net/mailarchive/[EMAIL PROTECTED]
however, the nillable="true" method does not seem to work for me here (I've
added it to the Bar and Boo mappings. Foo cannot take it, as it is
abstract), nor can I compact the array as I need the objects to be 100% the
same after a marshal / unmarshal.
I guess it isn't that strange that it isn't handled. Foo is abstract, so how
exactly would it represent a null?

My only real idea for how to solve this is to write a custom marshaller /
unmarshaller to handle this (and create a custom <null /> element for it),
but I'd rather not if it can be avoided.
I'd also like to avoid adding another object between the abstract Foo and
the concrete classes, if possible...

I may just be asking too much of the framework here and the custom
marshaller / unmarshaller is the best option, but experience tells me there
are loads of people smarter than me, and perhaps someone out there has
already solved this :-)

Regards,

Søren Andersen
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to