package org.silverpeas.mobile.shared.dto;

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

public class HomePageDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.HomePageDTO> {
  
  public static final HomePageDTO_Generated_JsonEncoderDecoder_ INSTANCE = new HomePageDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.HomePageDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeHomePageDTO2046081959(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeHomePageDTO2046081959( org.silverpeas.mobile.shared.dto.HomePageDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      com.google.gwt.json.client.JSONValue className=STRING.encode("HomePageDTO");
      if( className!=null ) { 
        rc.put("@class", className);
      }
      org.silverpeas.mobile.shared.dto.HomePageDTO parseValue = (org.silverpeas.mobile.shared.dto.HomePageDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getSpaceName()), rc, "spaceName");
      isNotNullValuePut(toJSON(parseValue.getSpacesAndApps(), org.silverpeas.mobile.shared.dto.navigation.SilverpeasObjectDTO_Generated_JsonEncoderDecoder_.INSTANCE), rc, "spacesAndApps");
      isNotNullValuePut(toJSON(parseValue.getNews(), org.silverpeas.mobile.shared.dto.news.NewsDTO_Generated_JsonEncoderDecoder_.INSTANCE), rc, "news");
      isNotNullValuePut(toJSON(parseValue.getFavorites(), org.silverpeas.mobile.shared.dto.MyLinkDTO_Generated_JsonEncoderDecoder_.INSTANCE), rc, "favorites");
      isNotNullValuePut(toJSON(parseValue.getLastPublications(), org.silverpeas.mobile.shared.dto.documents.PublicationDTO_Generated_JsonEncoderDecoder_.INSTANCE), rc, "lastPublications");
      isNotNullValuePut(toJSON(parseValue.getLastEvents(), org.silverpeas.mobile.shared.dto.almanach.CalendarEventDTO_Generated_JsonEncoderDecoder_.INSTANCE), rc, "lastEvents");
      isNotNullValuePut(toJSON(parseValue.getShortCuts(), org.silverpeas.mobile.shared.dto.ShortCutLinkDTO_Generated_JsonEncoderDecoder_.INSTANCE), rc, "shortCuts");
      isNotNullValuePut(toJSON(parseValue.getTools(), org.silverpeas.mobile.shared.dto.ShortCutLinkDTO_Generated_JsonEncoderDecoder_.INSTANCE), rc, "tools");
      isNotNullValuePut(STRING.encode(parseValue.getHtmlFreeZone()), rc, "htmlFreeZone");
      isNotNullValuePut(STRING.encode(parseValue.getNewsDisplayer()), rc, "newsDisplayer");
      isNotNullValuePut(STRING.encode(parseValue.getHtmlFreeZoneThin()), rc, "htmlFreeZoneThin");
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.HomePageDTO 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 decodeHomePageDTO2046081959(object);
      }
      
      private org.silverpeas.mobile.shared.dto.HomePageDTO decodeHomePageDTO2046081959(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.HomePageDTO rc = new org.silverpeas.mobile.shared.dto.HomePageDTO();
        rc.setSpaceName(getValueToSet(STRING.decode(object.get("spaceName")), null));
        rc.setSpacesAndApps(getValueToSet(toList(object.get("spacesAndApps"), org.silverpeas.mobile.shared.dto.navigation.SilverpeasObjectDTO_Generated_JsonEncoderDecoder_.INSTANCE), null));
        rc.setNews(getValueToSet(toList(object.get("news"), org.silverpeas.mobile.shared.dto.news.NewsDTO_Generated_JsonEncoderDecoder_.INSTANCE), null));
        rc.setFavorites(getValueToSet(toList(object.get("favorites"), org.silverpeas.mobile.shared.dto.MyLinkDTO_Generated_JsonEncoderDecoder_.INSTANCE), null));
        rc.setLastPublications(getValueToSet(toList(object.get("lastPublications"), org.silverpeas.mobile.shared.dto.documents.PublicationDTO_Generated_JsonEncoderDecoder_.INSTANCE), null));
        rc.setLastEvents(getValueToSet(toList(object.get("lastEvents"), org.silverpeas.mobile.shared.dto.almanach.CalendarEventDTO_Generated_JsonEncoderDecoder_.INSTANCE), null));
        rc.setShortCuts(getValueToSet(toList(object.get("shortCuts"), org.silverpeas.mobile.shared.dto.ShortCutLinkDTO_Generated_JsonEncoderDecoder_.INSTANCE), null));
        rc.setTools(getValueToSet(toList(object.get("tools"), org.silverpeas.mobile.shared.dto.ShortCutLinkDTO_Generated_JsonEncoderDecoder_.INSTANCE), null));
        rc.setHtmlFreeZone(getValueToSet(STRING.decode(object.get("htmlFreeZone")), null));
        rc.setNewsDisplayer(getValueToSet(STRING.decode(object.get("newsDisplayer")), null));
        rc.setHtmlFreeZoneThin(getValueToSet(STRING.decode(object.get("htmlFreeZoneThin")), null));
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        return rc;
      }
      
    }
