package org.silverpeas.mobile.shared.dto;

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

public class TaskDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.TaskDTO> {
  
  public static final TaskDTO_Generated_JsonEncoderDecoder_ INSTANCE = new TaskDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.TaskDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeTaskDTO1568746908(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeTaskDTO1568746908( org.silverpeas.mobile.shared.dto.TaskDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      com.google.gwt.json.client.JSONValue className=STRING.encode("TaskDTO");
      if( className!=null ) { 
        rc.put("@class", className);
      }
      org.silverpeas.mobile.shared.dto.TaskDTO parseValue = (org.silverpeas.mobile.shared.dto.TaskDTO)value;
      isNotNullValuePut(INT.encode(parseValue.getPercentCompleted()), rc, "percentCompleted");
      isNotNullValuePut(STRING.encode(parseValue.getPriority()), rc, "priority");
      isNotNullValuePut(STRING.encode(parseValue.getName()), rc, "name");
      isNotNullValuePut(STRING.encode(parseValue.getDelegator()), rc, "delegator");
      isNotNullValuePut(STRING.encode(parseValue.getEndDate()), rc, "endDate");
      isNotNullValuePut(STRING.encode(parseValue.getExternalId()), rc, "externalId");
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.TaskDTO 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 decodeTaskDTO1568746908(object);
      }
      
      private org.silverpeas.mobile.shared.dto.TaskDTO decodeTaskDTO1568746908(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.TaskDTO rc = new org.silverpeas.mobile.shared.dto.TaskDTO();
        rc.setPercentCompleted(getValueToSet(INT.decode(object.get("percentCompleted")), 0));
        rc.setPriority(getValueToSet(STRING.decode(object.get("priority")), null));
        rc.setName(getValueToSet(STRING.decode(object.get("name")), null));
        rc.setDelegator(getValueToSet(STRING.decode(object.get("delegator")), null));
        rc.setEndDate(getValueToSet(STRING.decode(object.get("endDate")), null));
        rc.setExternalId(getValueToSet(STRING.decode(object.get("externalId")), null));
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        return rc;
      }
      
    }
