package org.silverpeas.mobile.shared.dto.formsonline;

import static org.fusesource.restygwt.client.AbstractJsonEncoderDecoder.*;

public class FormDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.formsonline.FormDTO> {
  
  public static final FormDTO_Generated_JsonEncoderDecoder_ INSTANCE = new FormDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.formsonline.FormDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeFormDTO1490535788(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeFormDTO1490535788( org.silverpeas.mobile.shared.dto.formsonline.FormDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.formsonline.FormDTO parseValue = (org.silverpeas.mobile.shared.dto.formsonline.FormDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      isNotNullValuePut(STRING.encode(parseValue.getTitle()), rc, "title");
      isNotNullValuePut(STRING.encode(parseValue.getDescription()), rc, "description");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isReceiver()), rc, "receiver");
      isNotNullValuePut(INT.encode(parseValue.getNbRequests()), rc, "nbRequests");
      isNotNullValuePut(STRING.encode(parseValue.getXmlFormName()), rc, "xmlFormName");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.formsonline.FormDTO decode(com.google.gwt.json.client.JSONValue value) {
      if( value == null || value.isNull()!=null ) {
        return null;
      }
      com.google.gwt.json.client.JSONObject object = toObject(value);
        return decodeFormDTO1490535788(object);
      }
      
      private org.silverpeas.mobile.shared.dto.formsonline.FormDTO decodeFormDTO1490535788(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.formsonline.FormDTO rc = new org.silverpeas.mobile.shared.dto.formsonline.FormDTO();
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        rc.setTitle(getValueToSet(STRING.decode(object.get("title")), null));
        rc.setDescription(getValueToSet(STRING.decode(object.get("description")), null));
        rc.setReceiver(getValueToSet(BOOLEAN.decode(object.get("receiver")), false));
        rc.setNbRequests(getValueToSet(INT.decode(object.get("nbRequests")), 0));
        rc.setXmlFormName(getValueToSet(STRING.decode(object.get("xmlFormName")), null));
        return rc;
      }
      
    }
