adam.galloway wrote:
> 
> What I'd like to be able to tell from MyService.myMethod() is whether
> pojo.getDate() is null because the json had date nulled out or the json
> did not include the date field.
> 

Since Java doesn't have nillable types in the same way that .NET do, I think
you would have a hard time solving this issue. With my experience of CXF and
nillable types I've seen that when defining an element nillable, but
required like this:

@XmlElement(nillable=true, required=true)
private Date date;

Then the consumer classes (generated by CXF) would be something like this: 

private JAXBElement<Date> date;

The JAXBElement object has a isNull-method that you can use to see if the
element was sent in as null:
<MyPojo>
  <date xsi:nil="true"/>
</MyPojo>

Or if the value was sent but had the value null inside:
<MyPojo>
  <date></date>
</MyPojo>

I'm not sure if it is possible to accomplish these two variants of null when
you expose a service, since CXF does all the mapping directly on your
regular classes (no stubs in the picture).

--
Henning
-- 
View this message in context: 
http://www.nabble.com/Another-question-about-nillable%3Dtrue-and-minOccurs%3D0-tp22080637p22089791.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to