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

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

public class CommentDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.comments.CommentDTO> {
  
  public static final CommentDTO_Generated_JsonEncoderDecoder_ INSTANCE = new CommentDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.comments.CommentDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeCommentDTO413911447(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeCommentDTO413911447( org.silverpeas.mobile.shared.dto.comments.CommentDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.comments.CommentDTO parseValue = (org.silverpeas.mobile.shared.dto.comments.CommentDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getUri()), rc, "uri");
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      isNotNullValuePut(STRING.encode(parseValue.getComponentId()), rc, "componentId");
      isNotNullValuePut(STRING.encode(parseValue.getResourceType()), rc, "resourceType");
      isNotNullValuePut(STRING.encode(parseValue.getResourceId()), rc, "resourceId");
      isNotNullValuePut(STRING.encode(parseValue.getText()), rc, "text");
      isNotNullValuePut(STRING.encode(parseValue.getTextForHtml()), rc, "textForHtml");
      isNotNullValuePut(org.silverpeas.mobile.shared.dto.authentication.UserProfileDTO_Generated_JsonEncoderDecoder_.INSTANCE.encode(parseValue.getAuthor()), rc, "author");
      isNotNullValuePut(STRING.encode(parseValue.getCurrentUserLanguage()), rc, "currentUserLanguage");
      isNotNullValuePut(STRING.encode(parseValue.getCreationDate()), rc, "creationDate");
      isNotNullValuePut(STRING.encode(parseValue.getModificationDate()), rc, "modificationDate");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isIndexed()), rc, "indexed");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.comments.CommentDTO 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 decodeCommentDTO413911447(object);
      }
      
      private org.silverpeas.mobile.shared.dto.comments.CommentDTO decodeCommentDTO413911447(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.comments.CommentDTO rc = new org.silverpeas.mobile.shared.dto.comments.CommentDTO();
        rc.setUri(getValueToSet(STRING.decode(object.get("uri")), null));
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        rc.setComponentId(getValueToSet(STRING.decode(object.get("componentId")), null));
        rc.setResourceType(getValueToSet(STRING.decode(object.get("resourceType")), null));
        rc.setResourceId(getValueToSet(STRING.decode(object.get("resourceId")), null));
        rc.setText(getValueToSet(STRING.decode(object.get("text")), null));
        rc.setAuthor(getValueToSet(org.silverpeas.mobile.shared.dto.authentication.UserProfileDTO_Generated_JsonEncoderDecoder_.INSTANCE.decode(object.get("author")), null));
        rc.setCurrentUserLanguage(getValueToSet(STRING.decode(object.get("currentUserLanguage")), null));
        rc.setCreationDate(getValueToSet(STRING.decode(object.get("creationDate")), null));
        rc.setModificationDate(getValueToSet(STRING.decode(object.get("modificationDate")), null));
        rc.setIndexed(getValueToSet(BOOLEAN.decode(object.get("indexed")), false));
        return rc;
      }
      
    }
