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

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

public class SpaceDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.navigation.SpaceDTO> {
  
  public static final SpaceDTO_Generated_JsonEncoderDecoder_ INSTANCE = new SpaceDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.navigation.SpaceDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeSpaceDTO173682994(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeSpaceDTO173682994( org.silverpeas.mobile.shared.dto.navigation.SpaceDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      com.google.gwt.json.client.JSONValue className=STRING.encode("SpaceDTO");
      if( className!=null ) { 
        rc.put("@class", className);
      }
      org.silverpeas.mobile.shared.dto.navigation.SpaceDTO parseValue = (org.silverpeas.mobile.shared.dto.navigation.SpaceDTO)value;
      isNotNullValuePut(BOOLEAN.encode(parseValue.isPersonal()), rc, "personal");
      isNotNullValuePut(INT.encode(parseValue.getHomePageType()), rc, "homePageType");
      isNotNullValuePut(STRING.encode(parseValue.getHomePageParameter()), rc, "homePageParameter");
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      isNotNullValuePut(STRING.encode(parseValue.getLabel()), rc, "label");
      isNotNullValuePut(INT.encode(parseValue.getOrderNum()), rc, "orderNum");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.navigation.SpaceDTO 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 decodeSpaceDTO173682994(object);
      }
      
      private org.silverpeas.mobile.shared.dto.navigation.SpaceDTO decodeSpaceDTO173682994(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.navigation.SpaceDTO rc = new org.silverpeas.mobile.shared.dto.navigation.SpaceDTO();
        rc.setPersonal(getValueToSet(BOOLEAN.decode(object.get("personal")), false));
        rc.setHomePageType(getValueToSet(INT.decode(object.get("homePageType")), 0));
        rc.setHomePageParameter(getValueToSet(STRING.decode(object.get("homePageParameter")), null));
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        rc.setLabel(getValueToSet(STRING.decode(object.get("label")), null));
        rc.setOrderNum(getValueToSet(INT.decode(object.get("orderNum")), null));
        return rc;
      }
      
    }
