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

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

public class WorkflowDataDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.workflow.WorkflowDataDTO> {
  
  public static final WorkflowDataDTO_Generated_JsonEncoderDecoder_ INSTANCE = new WorkflowDataDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.workflow.WorkflowDataDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeWorkflowDataDTO2137289058(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeWorkflowDataDTO2137289058( org.silverpeas.mobile.shared.dto.workflow.WorkflowDataDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.workflow.WorkflowDataDTO parseValue = (org.silverpeas.mobile.shared.dto.workflow.WorkflowDataDTO)value;
      isNotNullValuePut(toJSON(parseValue.getHeaderLabels(), STRING, org.fusesource.restygwt.client.AbstractNestedJsonEncoderDecoder.listEncoderDecoder( STRING ), org.fusesource.restygwt.client.Json.Style.DEFAULT), rc, "headerLabels");
      isNotNullValuePut(toJSON(parseValue.getRoles(), STRING, STRING, org.fusesource.restygwt.client.Json.Style.DEFAULT), rc, "roles");
      isNotNullValuePut(toJSON(parseValue.getRolesAllowedToCreate(), STRING), rc, "rolesAllowedToCreate");
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.workflow.WorkflowDataDTO 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 decodeWorkflowDataDTO2137289058(object);
      }
      
      private org.silverpeas.mobile.shared.dto.workflow.WorkflowDataDTO decodeWorkflowDataDTO2137289058(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.workflow.WorkflowDataDTO rc = new org.silverpeas.mobile.shared.dto.workflow.WorkflowDataDTO();
        rc.setHeaderLabels(getValueToSet(toMap(object.get("headerLabels"), STRING, org.fusesource.restygwt.client.AbstractNestedJsonEncoderDecoder.listEncoderDecoder( STRING ), org.fusesource.restygwt.client.Json.Style.DEFAULT), null));
        rc.setRoles(getValueToSet(toMap(object.get("roles"), STRING, STRING, org.fusesource.restygwt.client.Json.Style.DEFAULT), null));
        rc.setRolesAllowedToCreate(getValueToSet(toList(object.get("rolesAllowedToCreate"), STRING), null));
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        return rc;
      }
      
    }
