package org.silverpeas.mobile.shared.dto;

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

public class StatusDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.StatusDTO> {
  
  public static final StatusDTO_Generated_JsonEncoderDecoder_ INSTANCE = new StatusDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.StatusDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeStatusDTO399317384(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeStatusDTO399317384( org.silverpeas.mobile.shared.dto.StatusDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.StatusDTO parseValue = (org.silverpeas.mobile.shared.dto.StatusDTO)value;
      isNotNullValuePut(INT.encode(parseValue.getId()), rc, "id");
      isNotNullValuePut(INT.encode(parseValue.getUserId()), rc, "userId");
      isNotNullValuePut(DATE.encode(parseValue.getCreationDate()), rc, "creationDate");
      isNotNullValuePut(STRING.encode(parseValue.getDescription()), rc, "description");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.StatusDTO 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 decodeStatusDTO399317384(object);
      }
      
      private org.silverpeas.mobile.shared.dto.StatusDTO decodeStatusDTO399317384(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.StatusDTO rc = new org.silverpeas.mobile.shared.dto.StatusDTO();
        rc.setId(getValueToSet(INT.decode(object.get("id")), 0));
        rc.setUserId(getValueToSet(INT.decode(object.get("userId")), 0));
        rc.setCreationDate(getValueToSet(DATE.decode(object.get("creationDate")), null));
        rc.setDescription(getValueToSet(STRING.decode(object.get("description")), null));
        return rc;
      }
      
    }
