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

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

public class PostDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.blog.PostDTO> {
  
  public static final PostDTO_Generated_JsonEncoderDecoder_ INSTANCE = new PostDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.blog.PostDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodePostDTO1543433591(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodePostDTO1543433591( org.silverpeas.mobile.shared.dto.blog.PostDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      com.google.gwt.json.client.JSONValue className=STRING.encode("PostDTO");
      if( className!=null ) { 
        rc.put("@class", className);
      }
      org.silverpeas.mobile.shared.dto.blog.PostDTO parseValue = (org.silverpeas.mobile.shared.dto.blog.PostDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getTitle()), rc, "title");
      isNotNullValuePut(STRING.encode(parseValue.getDescription()), rc, "description");
      isNotNullValuePut(STRING.encode(parseValue.getCategoryId()), rc, "categoryId");
      isNotNullValuePut(STRING.encode(parseValue.getCategoryName()), rc, "categoryName");
      isNotNullValuePut(STRING.encode(parseValue.getCreatorName()), rc, "creatorName");
      isNotNullValuePut(STRING.encode(parseValue.getDateEvent()), rc, "dateEvent");
      isNotNullValuePut(STRING.encode(parseValue.getCreationDate()), rc, "creationDate");
      isNotNullValuePut(STRING.encode(parseValue.getInstanceId()), rc, "instanceId");
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.blog.PostDTO 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 decodePostDTO1543433591(object);
      }
      
      private org.silverpeas.mobile.shared.dto.blog.PostDTO decodePostDTO1543433591(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.blog.PostDTO rc = new org.silverpeas.mobile.shared.dto.blog.PostDTO();
        rc.setTitle(getValueToSet(STRING.decode(object.get("title")), null));
        rc.setDescription(getValueToSet(STRING.decode(object.get("description")), null));
        rc.setCategoryId(getValueToSet(STRING.decode(object.get("categoryId")), null));
        rc.setCategoryName(getValueToSet(STRING.decode(object.get("categoryName")), null));
        rc.setCreatorName(getValueToSet(STRING.decode(object.get("creatorName")), null));
        rc.setDateEvent(getValueToSet(STRING.decode(object.get("dateEvent")), null));
        rc.setCreationDate(getValueToSet(STRING.decode(object.get("creationDate")), null));
        rc.setInstanceId(getValueToSet(STRING.decode(object.get("instanceId")), null));
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        return rc;
      }
      
    }
