jayesh dalwadi [
http://community.jboss.org/people/jayeshdalwadi] created the discussion
"I am using RESTEasy API in my app. I am using @BadgerFish annotation for mapping
json with POJO. so how to exclude additional fields"
To view the discussion, visit:
http://community.jboss.org/message/628948#628948
--------------------------------------------------------------
this is my pojo
@BadgerFish
public class User{
private Stirng name;
private int loginCount = 0;
public String getName() {
return name;
}
public void setName(String nm) {
this.name= nm;
}
public int getLoginCount() {
return loginCount;
}
public void setLoginCount(int loginCount) {
this.loginCount = loginCount;
}
}
my rest method
@POST
@Path("/user")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response postUser(@BadgerFish User user) {
System.out.println("post req.....");
return Response.status(200).entity("sucess"+p.getLoginCount()).build();
}
poblem is
JSON Data comes in POST Request:
Case 1: if JSON is -> {"name":"abc"} Response will be 0 (Works as
expected)
Case 2: if JSON is ->
{"name":"abc","loginCount":"12"}. It should not
set the value of loginCount in POJO obj. and Response should be 0.
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/628948#628948]
Start a new discussion in Beginner's Corner at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]