xmlbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Wegner <marty_weg...@yahoo.com>
Subject RE: Unions
Date Thu, 17 Feb 2005 04:18:14 GMT
Radu,

I think symmetry wins out.  That sounds like a logical decision.  Thanks
for the feedback.


--Marty

--- Radu Preotiuc-Pietro <radup@bea.com> wrote:

> The truth is, I wasn't involved in XmlBeans at the time this decision
> was made, so I couldn't tell for sure what the rationale behind it was.
> I must stress that type safety is only partially excluded for unions. If
> you union contains two pattern-ed strings, the Java type for it will be
> String. If you think about it, when you call a getter that returns an
> union type in Java, you don't know a priori what the returned value is
> going to be, so you have to assign the result to a type that can hold
> any of the possible values. The setters could be overridden to support
> just the union-ed types and nothing else, but I think it was either for
> simplicity or symmetry reasons that they are not.
> 
> Radu
> 
> -----Original Message-----
> From: Martin Wegner [mailto:marty_wegner@yahoo.com]
> Sent: Monday, February 14, 2005 5:59 PM
> To: user@xmlbeans.apache.org
> Subject: RE: Unions
> 
> 
> Radu,
> 
> Did you exclude type safety for unions because of ambiguous situations
> (all members of the union are ints, for example)?  I really love the
> type
> saftey aspect of XMLBeans (at least that is how we use, I know others do
> not) and was wondering if there was some way to maintain compile time
> type
> safety with respect to unions.
> 
> Thanks.
> 
> 
> --Marty
> 
> --- Radu Preotiuc-Pietro <radup@bea.com> wrote:
> 
> > You did not do anything wrong; the mapping of <union> is indeed an
> > Object (or whatever the "most common denominator" of the types in the
> > union is). However, the union support ensures that the runtime type of
> > the object corresponds to the member of the union that it matched.
> This
> > way, we have kept the API and the implementation classes simple and
> you
> > still have pretty much all the functionality you want.
> > 
> > -----Original Message-----
> > From: Martin Wegner [mailto:marty_wegner@yahoo.com]
> > Sent: Friday, February 11, 2005 12:45 PM
> > To: user@xmlbeans.apache.org
> > Subject: Unions
> > 
> > 
> > 
> > When an element has an attribute whose value is defined by an XSD
> union,
> > the set method on the object takes only an Object.  In testing the
> Java
> > code I found that validation works as expected.
> > 
> > The question I have is: is the set method that takes an Ojbect the
> > expected output of XMLBeans?  Or did I do something wrong?  I kind of
> > expected the union support to be reflected in the set methods.
> > 
> > Thanks.
> > 
> > 
> > --Marty
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> > For additional commands, e-mail: user-help@xmlbeans.apache.org
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> > For additional commands, e-mail: user-help@xmlbeans.apache.org
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Mime
View raw message