com.seejoke.wechat.entity.result.WxError Maven / Gradle / Ivy
package com.seejoke.wechat.entity.result;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.DeserializationConfig;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import java.io.IOException;
public class WxError{
private int errcode;
private String errmsg;
public WxError() {
}
public WxError(int errcode, String errmsg) {
this.errcode = errcode;
this.errmsg = errmsg;
}
public int getErrcode() {
return errcode;
}
public void setErrcode(int errcode) {
this.errcode = errcode;
}
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
public static WxError fromJson(String json) throws JsonParseException, JsonMappingException, IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return mapper.readValue(json, WxError.class);
}
@Override
public String toString() {
return "WxError [errcode=" + errcode + ", errmsg=" + errmsg + "]";
}
}