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

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

public class CalendarEventRecurrenceDTO_FrequencyDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.almanach.CalendarEventRecurrenceDTO.FrequencyDTO> {
  
  public static final CalendarEventRecurrenceDTO_FrequencyDTO_Generated_JsonEncoderDecoder_ INSTANCE = new CalendarEventRecurrenceDTO_FrequencyDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.almanach.CalendarEventRecurrenceDTO.FrequencyDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeFrequencyDTO1073363552(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeFrequencyDTO1073363552( org.silverpeas.mobile.shared.dto.almanach.CalendarEventRecurrenceDTO.FrequencyDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.almanach.CalendarEventRecurrenceDTO.FrequencyDTO parseValue = (org.silverpeas.mobile.shared.dto.almanach.CalendarEventRecurrenceDTO.FrequencyDTO)value;
      isNotNullValuePut(INT.encode(parseValue.getInterval()), rc, "interval");
      if(isNotNullAndCheckDefaults(parseValue.getTimeUnit(), rc, "timeUnit")) {
        isNotNullValuePut(org.silverpeas.mobile.shared.dto.almanach.TimeUnitDTO_Generated_JsonEncoderDecoder_.INSTANCE.encode(parseValue.getTimeUnit()), rc, "timeUnit");
      }
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.almanach.CalendarEventRecurrenceDTO.FrequencyDTO 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 decodeFrequencyDTO1073363552(object);
      }
      
      private org.silverpeas.mobile.shared.dto.almanach.CalendarEventRecurrenceDTO.FrequencyDTO decodeFrequencyDTO1073363552(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.almanach.CalendarEventRecurrenceDTO.FrequencyDTO rc = new org.silverpeas.mobile.shared.dto.almanach.CalendarEventRecurrenceDTO.FrequencyDTO();
        rc.setInterval(getValueToSet(INT.decode(object.get("interval")), 0));
        rc.setTimeUnit(getValueToSet(org.silverpeas.mobile.shared.dto.almanach.TimeUnitDTO_Generated_JsonEncoderDecoder_.INSTANCE.decode(object.get("timeUnit")), null));
        return rc;
      }
      
    }
