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 encodeCalendarDTO1809501578(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeCalendarDTO1809501578( 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 decodeCalendarDTO1809501578(object);
      }
      
      private org.silverpeas.mobile.shared.dto.almanach.CalendarDTO decodeCalendarDTO1809501578(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;
      }
      
    }
