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

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

public class ApplicationInstanceDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.navigation.ApplicationInstanceDTO> {
  
  public static final ApplicationInstanceDTO_Generated_JsonEncoderDecoder_ INSTANCE = new ApplicationInstanceDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.navigation.ApplicationInstanceDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeApplicationInstanceDTO804235588(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeApplicationInstanceDTO804235588( org.silverpeas.mobile.shared.dto.navigation.ApplicationInstanceDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      com.google.gwt.json.client.JSONValue className=STRING.encode("ApplicationInstanceDTO");
      if( className!=null ) { 
        rc.put("@class", className);
      }
      org.silverpeas.mobile.shared.dto.navigation.ApplicationInstanceDTO parseValue = (org.silverpeas.mobile.shared.dto.navigation.ApplicationInstanceDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getType()), rc, "type");
      isNotNullValuePut(org.silverpeas.mobile.shared.dto.RightDTO_Generated_JsonEncoderDecoder_.INSTANCE.encode(parseValue.getRights()), rc, "rights");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getCommentable()), rc, "commentable");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getNotifiable()), rc, "notifiable");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getAbleToStoreContent()), rc, "ableToStoreContent");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getWorkflow()), rc, "workflow");
      isNotNullValuePut(STRING.encode(parseValue.getExtraId()), rc, "extraId");
      isNotNullValuePut(INT.encode(parseValue.getFolderSharing()), rc, "folderSharing");
      isNotNullValuePut(INT.encode(parseValue.getPublicationSharing()), rc, "publicationSharing");
      isNotNullValuePut(INT.encode(parseValue.getFileSharing()), rc, "fileSharing");
      isNotNullValuePut(toJSON(parseValue.getParameters(), STRING, STRING, org.fusesource.restygwt.client.Json.Style.DEFAULT), rc, "parameters");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getPersonnal()), rc, "personnal");
      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.ApplicationInstanceDTO 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 decodeApplicationInstanceDTO804235588(object);
      }
      
      private org.silverpeas.mobile.shared.dto.navigation.ApplicationInstanceDTO decodeApplicationInstanceDTO804235588(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.navigation.ApplicationInstanceDTO rc = new org.silverpeas.mobile.shared.dto.navigation.ApplicationInstanceDTO();
        rc.setType(getValueToSet(STRING.decode(object.get("type")), null));
        rc.setRights(getValueToSet(org.silverpeas.mobile.shared.dto.RightDTO_Generated_JsonEncoderDecoder_.INSTANCE.decode(object.get("rights")), null));
        rc.setCommentable(getValueToSet(BOOLEAN.decode(object.get("commentable")), false));
        rc.setNotifiable(getValueToSet(BOOLEAN.decode(object.get("notifiable")), false));
        rc.setAbleToStoreContent(getValueToSet(BOOLEAN.decode(object.get("ableToStoreContent")), false));
        rc.setWorkflow(getValueToSet(BOOLEAN.decode(object.get("workflow")), false));
        rc.setExtraId(getValueToSet(STRING.decode(object.get("extraId")), null));
        rc.setFolderSharing(getValueToSet(INT.decode(object.get("folderSharing")), 0));
        rc.setPublicationSharing(getValueToSet(INT.decode(object.get("publicationSharing")), 0));
        rc.setFileSharing(getValueToSet(INT.decode(object.get("fileSharing")), 0));
        rc.setParameters(getValueToSet(toMap(object.get("parameters"), STRING, STRING, org.fusesource.restygwt.client.Json.Style.DEFAULT), null));
        rc.setPersonnal(getValueToSet(BOOLEAN.decode(object.get("personnal")), false));
        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;
      }
      
    }
