cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "adam.galloway" <adam.gallo...@scala.com>
Subject Another question about nillable=true and minOccurs=0
Date Wed, 18 Feb 2009 15:05:58 GMT

I have a JAX-RS service that Consumes json which maps to a POJO with JAXB. 
I'm having a hard time finding out how to tell wether a particular field has
been sent in with a null value or whether the value of the field was left
out of the incoming json.

The basic idea is that I have a pojo defined like this:

@XmlRootElement(name = "myPojo")
public class MyPojo {
   private Long id;
   private String name;
   private Date date;

   // getters and setters...
}

My service:

@Path("/myservice/")
public class MyService {

   @POST
   @Path("/mymethod/")
   @Consumes("application/json")
   public Response myMethod(MyPojo pojo) {
        //process pojo here
   }
}

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.

Any suggestions would be greatly appreciated.
-- 
View this message in context: http://www.nabble.com/Another-question-about-nillable%3Dtrue-and-minOccurs%3D0-tp22080637p22080637.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message