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

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

public class ReminderDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.reminder.ReminderDTO> {
  
  public static final ReminderDTO_Generated_JsonEncoderDecoder_ INSTANCE = new ReminderDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.reminder.ReminderDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeReminderDTO168438225(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeReminderDTO168438225( org.silverpeas.mobile.shared.dto.reminder.ReminderDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.reminder.ReminderDTO parseValue = (org.silverpeas.mobile.shared.dto.reminder.ReminderDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      isNotNullValuePut(STRING.encode(parseValue.getcId()), rc, "cId");
      isNotNullValuePut(STRING.encode(parseValue.getcProperty()), rc, "cProperty");
      isNotNullValuePut(STRING.encode(parseValue.getUserId()), rc, "userId");
      isNotNullValuePut(STRING.encode(parseValue.getDateTime()), rc, "dateTime");
      isNotNullValuePut(INT.encode(parseValue.getDuration()), rc, "duration");
      if(isNotNullAndCheckDefaults(parseValue.getTimeUnit(), rc, "timeUnit")) {
        isNotNullValuePut(org.silverpeas.mobile.shared.dto.almanach.TimeUnitDTO_Generated_JsonEncoderDecoder_.INSTANCE.encode(parseValue.getTimeUnit()), rc, "timeUnit");
      }
      isNotNullValuePut(STRING.encode(parseValue.getText()), rc, "text");
      isNotNullValuePut(STRING.encode(parseValue.getProcessName()), rc, "processName");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isCanBeModified()), rc, "canBeModified");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isCanBeDeleted()), rc, "canBeDeleted");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.reminder.ReminderDTO 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 decodeReminderDTO168438225(object);
      }
      
      private org.silverpeas.mobile.shared.dto.reminder.ReminderDTO decodeReminderDTO168438225(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.reminder.ReminderDTO rc = new org.silverpeas.mobile.shared.dto.reminder.ReminderDTO();
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        rc.setcId(getValueToSet(STRING.decode(object.get("cId")), null));
        rc.setcProperty(getValueToSet(STRING.decode(object.get("cProperty")), null));
        rc.setUserId(getValueToSet(STRING.decode(object.get("userId")), null));
        rc.setDateTime(getValueToSet(STRING.decode(object.get("dateTime")), null));
        rc.setDuration(getValueToSet(INT.decode(object.get("duration")), null));
        rc.setTimeUnit(getValueToSet(org.silverpeas.mobile.shared.dto.almanach.TimeUnitDTO_Generated_JsonEncoderDecoder_.INSTANCE.decode(object.get("timeUnit")), null));
        rc.setText(getValueToSet(STRING.decode(object.get("text")), null));
        rc.setProcessName(getValueToSet(STRING.decode(object.get("processName")), null));
        rc.setCanBeModified(getValueToSet(BOOLEAN.decode(object.get("canBeModified")), false));
        rc.setCanBeDeleted(getValueToSet(BOOLEAN.decode(object.get("canBeDeleted")), false));
        return rc;
      }
      
    }
