So, what would be a better way? What I really want is for them to be able
to pass in an
int, a percent, or a constant. How best to do that?
Malachi
On Thu, 14 Aug 2003 08:50:39 -0700, Kohsuke Kawaguchi
<Kohsuke.Kawaguchi_at_Sun.COM> wrote:
>
>> The autogenerated classes return Serializable as the type, instead of
>> something useful:
>>
>> getHeight
>> public Serializable getHeight()
>> Returns:
>> possible object is intString
>>
>> setHeight
>> public void setHeight(Serializable value)
>> Parameters:
>> value - allowed object is intString
>>
>>
>> Any ideas? Basically, I want to get either an int or some constant to
>> identify their choice.
>
> The first part of the union says the type is int, the other part says
> it's String. So XJC tried to find the common base type for them.
>
> It basically tries to find a type T such that:
>
> 1. all the concrete types are assignable to T
> 2. There's no other T' to which all the concrete types are assignable to
> T' and T' extends from T.
>
> java.io.Serializable fits this condition, so that's why you are seeing
> it. I agree that it's not nice, but since the compiler has no knowledge
> of the semantics, it's bit hard for XJC to recognize it shouldn't be
> using Serializable.
>
>
> The easiest way, I guess, is perhaps to use a conversion customization.
> In your conversion method, you can invoke
> javax.xml.bind.DatatypeConverter to do the hard work. Or you might also
> be able to <jaxb:property> with <jaxb:baseType>, but I have to admit
> that this area has been changed a lot during JAXB 1.0 so I don't
> remember what exactly the spec says.
>
>
> regards,
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
>
--
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net