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

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

public class NewsDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.news.NewsDTO> {
  
  public static final NewsDTO_Generated_JsonEncoderDecoder_ INSTANCE = new NewsDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.news.NewsDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeNewsDTO1160580602(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeNewsDTO1160580602( org.silverpeas.mobile.shared.dto.news.NewsDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      com.google.gwt.json.client.JSONValue className=STRING.encode("NewsDTO");
      if( className!=null ) { 
        rc.put("@class", className);
      }
      org.silverpeas.mobile.shared.dto.news.NewsDTO parseValue = (org.silverpeas.mobile.shared.dto.news.NewsDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getIdNews()), rc, "idNews");
      isNotNullValuePut(STRING.encode(parseValue.getTitle()), rc, "title");
      isNotNullValuePut(STRING.encode(parseValue.getDescription()), rc, "description");
      isNotNullValuePut(STRING.encode(parseValue.getUpdateDate()), rc, "updateDate");
      isNotNullValuePut(STRING.encode(parseValue.getVignette()), rc, "vignette");
      isNotNullValuePut(STRING.encode(parseValue.getInstanceId()), rc, "instanceId");
      isNotNullValuePut(STRING.encode(parseValue.getStartDate()), rc, "startDate");
      isNotNullValuePut(STRING.encode(parseValue.getEndDate()), rc, "endDate");
      isNotNullValuePut(STRING.encode(parseValue.getContent()), rc, "content");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getImportant()), rc, "important");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getDraft()), rc, "draft");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getVisible()), rc, "visible");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getManagable()), rc, "managable");
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.news.NewsDTO 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 decodeNewsDTO1160580602(object);
      }
      
      private org.silverpeas.mobile.shared.dto.news.NewsDTO decodeNewsDTO1160580602(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.news.NewsDTO rc = new org.silverpeas.mobile.shared.dto.news.NewsDTO();
        rc.setIdNews(getValueToSet(STRING.decode(object.get("idNews")), null));
        rc.setTitle(getValueToSet(STRING.decode(object.get("title")), null));
        rc.setDescription(getValueToSet(STRING.decode(object.get("description")), null));
        rc.setUpdateDate(getValueToSet(STRING.decode(object.get("updateDate")), null));
        rc.setVignette(getValueToSet(STRING.decode(object.get("vignette")), null));
        rc.setInstanceId(getValueToSet(STRING.decode(object.get("instanceId")), null));
        rc.setStartDate(getValueToSet(STRING.decode(object.get("startDate")), null));
        rc.setEndDate(getValueToSet(STRING.decode(object.get("endDate")), null));
        rc.setContent(getValueToSet(STRING.decode(object.get("content")), null));
        rc.setImportant(getValueToSet(BOOLEAN.decode(object.get("important")), false));
        rc.setDraft(getValueToSet(BOOLEAN.decode(object.get("draft")), false));
        rc.setVisible(getValueToSet(BOOLEAN.decode(object.get("visible")), false));
        rc.setManagable(getValueToSet(BOOLEAN.decode(object.get("managable")), false));
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        return rc;
      }
      
    }
