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

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

public class ReplyDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.faq.ReplyDTO> {
  
  public static final ReplyDTO_Generated_JsonEncoderDecoder_ INSTANCE = new ReplyDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.faq.ReplyDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeReplyDTO92682442(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeReplyDTO92682442( org.silverpeas.mobile.shared.dto.faq.ReplyDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.faq.ReplyDTO parseValue = (org.silverpeas.mobile.shared.dto.faq.ReplyDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      isNotNullValuePut(STRING.encode(parseValue.getTitle()), rc, "title");
      isNotNullValuePut(STRING.encode(parseValue.getContent()), rc, "content");
      isNotNullValuePut(toJSON(parseValue.getAttachments(), org.silverpeas.mobile.shared.dto.documents.SimpleDocumentDTO_Generated_JsonEncoderDecoder_.INSTANCE), rc, "attachments");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.faq.ReplyDTO 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 decodeReplyDTO92682442(object);
      }
      
      private org.silverpeas.mobile.shared.dto.faq.ReplyDTO decodeReplyDTO92682442(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.faq.ReplyDTO rc = new org.silverpeas.mobile.shared.dto.faq.ReplyDTO();
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        rc.setTitle(getValueToSet(STRING.decode(object.get("title")), null));
        rc.setContent(getValueToSet(STRING.decode(object.get("content")), null));
        rc.setAttachments(getValueToSet(toList(object.get("attachments"), org.silverpeas.mobile.shared.dto.documents.SimpleDocumentDTO_Generated_JsonEncoderDecoder_.INSTANCE), null));
        return rc;
      }
      
    }
