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

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

public class WorkflowInstanceDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.workflow.WorkflowInstanceDTO> {
  
  public static final WorkflowInstanceDTO_Generated_JsonEncoderDecoder_ INSTANCE = new WorkflowInstanceDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.workflow.WorkflowInstanceDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeWorkflowInstanceDTO1209169047(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeWorkflowInstanceDTO1209169047( org.silverpeas.mobile.shared.dto.workflow.WorkflowInstanceDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.workflow.WorkflowInstanceDTO parseValue = (org.silverpeas.mobile.shared.dto.workflow.WorkflowInstanceDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getTitle()), rc, "title");
      isNotNullValuePut(STRING.encode(parseValue.getState()), rc, "state");
      isNotNullValuePut(toJSON(parseValue.getHeaderFieldsValues(), STRING), rc, "headerFieldsValues");
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.workflow.WorkflowInstanceDTO 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 decodeWorkflowInstanceDTO1209169047(object);
      }
      
      private org.silverpeas.mobile.shared.dto.workflow.WorkflowInstanceDTO decodeWorkflowInstanceDTO1209169047(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.workflow.WorkflowInstanceDTO rc = new org.silverpeas.mobile.shared.dto.workflow.WorkflowInstanceDTO();
        rc.setTitle(getValueToSet(STRING.decode(object.get("title")), null));
        rc.setState(getValueToSet(STRING.decode(object.get("state")), null));
        rc.setHeaderFieldsValues(getValueToSet(toList(object.get("headerFieldsValues"), STRING), null));
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        return rc;
      }
      
    }
