//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2013.12.10 at 05:12:48 PM BRST
//
package br.com.centralit.citsmart.rest.schema;
import java.lang.reflect.Type;
import java.math.BigInteger;
import java.util.GregorianCalendar;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
public class BICitsmartRespDeserializer implements JsonDeserializer<BICitsmartResp> {
@Override
public BICitsmartResp deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
throws JsonParseException {
BICitsmartResp resp = new BICitsmartResp();
BigInteger operationId = null;
String xml = null;
CtError error = null;
XMLGregorianCalendar dateTime = null;
JsonObject jsonObject = json.getAsJsonObject();
if (!(jsonObject.get("operationID") instanceof JsonNull)) {
operationId = jsonObject.get("operationID").getAsBigInteger();
}
if (!(jsonObject.get("xml") instanceof JsonNull)) {
xml = jsonObject.get("xml").getAsString();
}
if (!(jsonObject.get("error") instanceof JsonNull)) {
error = context.deserialize(jsonObject.get("error"), CtError.class);
}
if (!(jsonObject.get("dateTime") instanceof JsonNull)) {
try {
GregorianCalendar gc = new GregorianCalendar();
long dt = jsonObject.get("dateTime").getAsLong();
gc.setTimeInMillis(dt);
dateTime = DatatypeFactory.newInstance().newXMLGregorianCalendar(gc);
} catch (DatatypeConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
resp.setDateTime(dateTime);
resp.setOperationID(operationId);
resp.setError(error);
resp.setXml(xml);
return resp;
/*
{
"dateTime":1412859455000,
"operationID":null,
"error":{
"code":"PARAM",
"description":"Usu�rio n�o tem acesso � opera��o"
},
"xml":null
}
*/
}
}