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

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

public class TopicDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.documents.TopicDTO> {
  
  public static final TopicDTO_Generated_JsonEncoderDecoder_ INSTANCE = new TopicDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.documents.TopicDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeTopicDTO375374890(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeTopicDTO375374890( org.silverpeas.mobile.shared.dto.documents.TopicDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      com.google.gwt.json.client.JSONValue className=STRING.encode("TopicDTO");
      if( className!=null ) { 
        rc.put("@class", className);
      }
      org.silverpeas.mobile.shared.dto.documents.TopicDTO parseValue = (org.silverpeas.mobile.shared.dto.documents.TopicDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getName()), rc, "name");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isTerminal()), rc, "terminal");
      isNotNullValuePut(INT.encode(parseValue.getPubCount()), rc, "pubCount");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isRoot()), rc, "root");
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.documents.TopicDTO 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 decodeTopicDTO375374890(object);
      }
      
      private org.silverpeas.mobile.shared.dto.documents.TopicDTO decodeTopicDTO375374890(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.documents.TopicDTO rc = new org.silverpeas.mobile.shared.dto.documents.TopicDTO();
        rc.setName(getValueToSet(STRING.decode(object.get("name")), null));
        rc.setTerminal(getValueToSet(BOOLEAN.decode(object.get("terminal")), false));
        rc.setPubCount(getValueToSet(INT.decode(object.get("pubCount")), 0));
        rc.setRoot(getValueToSet(BOOLEAN.decode(object.get("root")), false));
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        return rc;
      }
      
    }
