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

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

public class AttachmentDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.documents.AttachmentDTO> {
  
  public static final AttachmentDTO_Generated_JsonEncoderDecoder_ INSTANCE = new AttachmentDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.documents.AttachmentDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeAttachmentDTO1042469607(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeAttachmentDTO1042469607( org.silverpeas.mobile.shared.dto.documents.AttachmentDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.documents.AttachmentDTO parseValue = (org.silverpeas.mobile.shared.dto.documents.AttachmentDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getType()), rc, "type");
      isNotNullValuePut(LONG.encode(parseValue.getSize()), rc, "size");
      isNotNullValuePut(STRING.encode(parseValue.getAuthor()), rc, "author");
      isNotNullValuePut(STRING.encode(parseValue.getTitle()), rc, "title");
      isNotNullValuePut(INT.encode(parseValue.getOrderNum()), rc, "orderNum");
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      isNotNullValuePut(STRING.encode(parseValue.getInstanceId()), rc, "instanceId");
      isNotNullValuePut(STRING.encode(parseValue.getLang()), rc, "lang");
      isNotNullValuePut(STRING.encode(parseValue.getUserId()), rc, "userId");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isDownloadAllowed()), rc, "downloadAllowed");
      isNotNullValuePut(STRING.encode(parseValue.getDescription()), rc, "description");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.documents.AttachmentDTO 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 decodeAttachmentDTO1042469607(object);
      }
      
      private org.silverpeas.mobile.shared.dto.documents.AttachmentDTO decodeAttachmentDTO1042469607(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.documents.AttachmentDTO rc = new org.silverpeas.mobile.shared.dto.documents.AttachmentDTO();
        rc.setType(getValueToSet(STRING.decode(object.get("type")), null));
        rc.setSize(getValueToSet(LONG.decode(object.get("size")), 0L));
        rc.setAuthor(getValueToSet(STRING.decode(object.get("author")), null));
        rc.setTitle(getValueToSet(STRING.decode(object.get("title")), null));
        rc.setOrderNum(getValueToSet(INT.decode(object.get("orderNum")), 0));
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        rc.setInstanceId(getValueToSet(STRING.decode(object.get("instanceId")), null));
        rc.setLang(getValueToSet(STRING.decode(object.get("lang")), null));
        rc.setUserId(getValueToSet(STRING.decode(object.get("userId")), null));
        rc.setDownloadAllowed(getValueToSet(BOOLEAN.decode(object.get("downloadAllowed")), false));
        rc.setDescription(getValueToSet(STRING.decode(object.get("description")), null));
        return rc;
      }
      
    }
