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 encodeWorkflowDataDTO1411277761(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeWorkflowDataDTO1411277761( 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 decodeWorkflowDataDTO1411277761(object);
      }
      
      private org.silverpeas.mobile.shared.dto.workflow.WorkflowDataDTO decodeWorkflowDataDTO1411277761(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;
      }
      
    }
