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

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

public class NotificationToSendDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.notifications.NotificationToSendDTO> {
  
  public static final NotificationToSendDTO_Generated_JsonEncoderDecoder_ INSTANCE = new NotificationToSendDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.notifications.NotificationToSendDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeNotificationToSendDTO2071839596(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeNotificationToSendDTO2071839596( org.silverpeas.mobile.shared.dto.notifications.NotificationToSendDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.notifications.NotificationToSendDTO parseValue = (org.silverpeas.mobile.shared.dto.notifications.NotificationToSendDTO)value;
      isNotNullValuePut(org.silverpeas.mobile.shared.dto.notifications.NotificationDTO_Generated_JsonEncoderDecoder_.INSTANCE.encode(parseValue.getNotification()), rc, "notification");
      isNotNullValuePut(toJSON(parseValue.getReceivers(), org.silverpeas.mobile.shared.dto.BaseDTO_Generated_JsonEncoderDecoder_.INSTANCE), rc, "receivers");
      isNotNullValuePut(STRING.encode(parseValue.getSubject()), rc, "subject");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.notifications.NotificationToSendDTO 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 decodeNotificationToSendDTO2071839596(object);
      }
      
      private org.silverpeas.mobile.shared.dto.notifications.NotificationToSendDTO decodeNotificationToSendDTO2071839596(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.notifications.NotificationToSendDTO rc = new org.silverpeas.mobile.shared.dto.notifications.NotificationToSendDTO();
        rc.setNotification(getValueToSet(org.silverpeas.mobile.shared.dto.notifications.NotificationDTO_Generated_JsonEncoderDecoder_.INSTANCE.decode(object.get("notification")), null));
        rc.setReceivers(getValueToSet(toList(object.get("receivers"), org.silverpeas.mobile.shared.dto.BaseDTO_Generated_JsonEncoderDecoder_.INSTANCE), null));
        rc.setSubject(getValueToSet(STRING.decode(object.get("subject")), null));
        return rc;
      }
      
    }
