1

I have added resteasy-jackson provider jar in my pom.xml I have one pojo class annotated with jaxb annotations :

Request.java

@XmlElement
public List<Object> getListSO() {
    return listSO;
}

I have written an resteasy client to access a rest webservice. I am passing this request object as a parameter to webservice.

Rest Webservice

@POST
@Path("/authorizefields")
@Produces("application/json; charset=ISO-8859-1")
@Consumes("application/json; charset=ISO-8859-1")
public Reply getFields(Request request) {
}

Now from rest client if i add some object to list say

listSO.add(new Sample());
request.setListSO(listSO);

and pass it to the rest webservice I am not able to get sample object in ws. Is there any jaxb or jackson annotation needed to put on list of object to support polymorphism?


The easiest way is to just subtract out the value of '0':

char c = '4';
int i = (int)(c - '0');

Or you could go through string instead:

char c = '4';
int i = int.Parse(c.ToString());

Note that if you have a string instead of a char, just do:

string value = "4";
int i = int.Parse(value);
4

0 に答える 0