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

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

public class SurveyDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.survey.SurveyDTO> {
  
  public static final SurveyDTO_Generated_JsonEncoderDecoder_ INSTANCE = new SurveyDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.survey.SurveyDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeSurveyDTO1645176787(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeSurveyDTO1645176787( org.silverpeas.mobile.shared.dto.survey.SurveyDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.survey.SurveyDTO parseValue = (org.silverpeas.mobile.shared.dto.survey.SurveyDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      isNotNullValuePut(STRING.encode(parseValue.getCreator()), rc, "creator");
      isNotNullValuePut(STRING.encode(parseValue.getCreationDate()), rc, "creationDate");
      isNotNullValuePut(STRING.encode(parseValue.getBeginDate()), rc, "beginDate");
      isNotNullValuePut(STRING.encode(parseValue.getEndDate()), rc, "endDate");
      isNotNullValuePut(STRING.encode(parseValue.getNbVotes()), rc, "nbVotes");
      isNotNullValuePut(INT.encode(parseValue.getNbMaxParticipations()), rc, "nbMaxParticipations");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isAnonymous()), rc, "anonymous");
      isNotNullValuePut(STRING.encode(parseValue.getName()), rc, "name");
      isNotNullValuePut(STRING.encode(parseValue.getDescription()), rc, "description");
      isNotNullValuePut(INT.encode(parseValue.getResultMode()), rc, "resultMode");
      isNotNullValuePut(INT.encode(parseValue.getResultView()), rc, "resultView");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.survey.SurveyDTO 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 decodeSurveyDTO1645176787(object);
      }
      
      private org.silverpeas.mobile.shared.dto.survey.SurveyDTO decodeSurveyDTO1645176787(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.survey.SurveyDTO rc = new org.silverpeas.mobile.shared.dto.survey.SurveyDTO();
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        rc.setCreator(getValueToSet(STRING.decode(object.get("creator")), null));
        rc.setCreationDate(getValueToSet(STRING.decode(object.get("creationDate")), null));
        rc.setBeginDate(getValueToSet(STRING.decode(object.get("beginDate")), null));
        rc.setEndDate(getValueToSet(STRING.decode(object.get("endDate")), null));
        rc.setNbVotes(getValueToSet(STRING.decode(object.get("nbVotes")), null));
        rc.setNbMaxParticipations(getValueToSet(INT.decode(object.get("nbMaxParticipations")), 0));
        rc.setAnonymous(getValueToSet(BOOLEAN.decode(object.get("anonymous")), false));
        rc.setName(getValueToSet(STRING.decode(object.get("name")), null));
        rc.setDescription(getValueToSet(STRING.decode(object.get("description")), null));
        rc.setResultMode(getValueToSet(INT.decode(object.get("resultMode")), 0));
        rc.setResultView(getValueToSet(INT.decode(object.get("resultView")), 0));
        return rc;
      }
      
    }
