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

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

public class CalendarDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.almanach.CalendarDTO> {
  
  public static final CalendarDTO_Generated_JsonEncoderDecoder_ INSTANCE = new CalendarDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.almanach.CalendarDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeCalendarDTO271177523(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeCalendarDTO271177523( org.silverpeas.mobile.shared.dto.almanach.CalendarDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.almanach.CalendarDTO parseValue = (org.silverpeas.mobile.shared.dto.almanach.CalendarDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      isNotNullValuePut(STRING.encode(parseValue.getTitle()), rc, "title");
      isNotNullValuePut(STRING.encode(parseValue.getZoneId()), rc, "zoneId");
      isNotNullValuePut(STRING.encode(parseValue.getUri()), rc, "uri");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isMain()), rc, "main");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isUserMainPersonal()), rc, "userMainPersonal");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isUserPersonal()), rc, "userPersonal");
      isNotNullValuePut(STRING.encode(parseValue.getOwnerName()), rc, "ownerName");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.almanach.CalendarDTO 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 decodeCalendarDTO271177523(object);
      }
      
      private org.silverpeas.mobile.shared.dto.almanach.CalendarDTO decodeCalendarDTO271177523(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.almanach.CalendarDTO rc = new org.silverpeas.mobile.shared.dto.almanach.CalendarDTO();
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        rc.setTitle(getValueToSet(STRING.decode(object.get("title")), null));
        rc.setZoneId(getValueToSet(STRING.decode(object.get("zoneId")), null));
        rc.setUri(getValueToSet(STRING.decode(object.get("uri")), null));
        rc.setMain(getValueToSet(BOOLEAN.decode(object.get("main")), false));
        rc.setUserMainPersonal(getValueToSet(BOOLEAN.decode(object.get("userMainPersonal")), false));
        rc.setUserPersonal(getValueToSet(BOOLEAN.decode(object.get("userPersonal")), false));
        rc.setOwnerName(getValueToSet(STRING.decode(object.get("ownerName")), null));
        return rc;
      }
      
    }
