users@jaxb.java.net

Re: Unset method not generated

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 06 Nov 2006 09:59:33 -0800

Lichtenwalter, Ryan wrote:
> I have a problem where, for an optional schema attribute, though xjc
> generates an isSet method, a setter, and a getter, it does not create an
> unset method and the marhsaller fails if I do not use the set method to
> provide a value. xjc failes to produce the unset method even if I add a
> custom binding for the attribute using:
>
> <jxb:bindings schemaLocation="------------"
> node=".//xs:attribute[@name='updatedSince']">
> <jxb:property generateUnsetMethod="true"/>
> </jxb:bindings
>
> Here is the schema definition for this attribute.
>
> <xs:attribute name="updatedSince" type="xs:dateTime"
> use="optional"/>
>
>
> The strange thing is that it does correctly generate unset methods for
> other optional elements and attributes even without the binding
> customization. Any ideas what the problem is and how I can solve it.

There might be a lack of error reporting here, but when the property is
a reference type, I thought you wouldn't need unset method, because you
can just set null.

Oh wait, which version of JAXB is this?


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com