> Adam Chesney wrote: > > Hi, > > I note from the status page > (http://castor.exolab.org/status.html#What's-missing) that you are > planning to add support for the Union type. > > I am trying to bind to a schema which contains a number of union > types, so I was wondering if this was likely to be achieved anytime > soon. Also, I was wondering how you are planning on implementing it as > it seems to go against the object-oriented nature of Java. We are currently not coding support for Union at the moment. So I don't have an actual time estimate. However, I don't believe it would take very long once someone actually sits down to do it. > > Okay, so I can see that you could have 2 or more over-loaded set > methods for the different types of parameter, but the get method is a > bit trickier, what does it return? The get and set methods would probably have to return the common base type for all items in the Union. The worst case scenario would lead to java.lang.Object, or perhaps a java.lang.String would suffice. > > Anyway, should I wait for Castor to implement this or hack the schemas > to remove the union types and just go with the lowest common > denominator (i.e. replace with xsd:string :)? > You could always try coding support for Union and contributing it back to the project. Our Schema Object Model (org.exolab.castor.xml.schema) does support it. The builder package (org.exolab.castor.builder) would need to check for it and handle it. I think the easiest solution is to just convert all unions as strings in the Java object model. The only tricky part is the validation. Validation can be accomplished by trying all possible validators for the types specified in the Union on the value, if none pass it's an error, if any pass, then it's good. --Keith ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
