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

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

public class WorkflowFieldDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.workflow.WorkflowFieldDTO> {
  
  public static final WorkflowFieldDTO_Generated_JsonEncoderDecoder_ INSTANCE = new WorkflowFieldDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.workflow.WorkflowFieldDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeWorkflowFieldDTO107784722(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeWorkflowFieldDTO107784722( org.silverpeas.mobile.shared.dto.workflow.WorkflowFieldDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.workflow.WorkflowFieldDTO parseValue = (org.silverpeas.mobile.shared.dto.workflow.WorkflowFieldDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getActionName()), rc, "actionName");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isReadOnly()), rc, "readOnly");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isMandatory()), rc, "mandatory");
      isNotNullValuePut(STRING.encode(parseValue.getDisplayerName()), rc, "displayerName");
      isNotNullValuePut(STRING.encode(parseValue.getName()), rc, "name");
      isNotNullValuePut(STRING.encode(parseValue.getLabel()), rc, "label");
      isNotNullValuePut(STRING.encode(parseValue.getValue()), rc, "value");
      isNotNullValuePut(STRING.encode(parseValue.getValueId()), rc, "valueId");
      isNotNullValuePut(STRING.encode(parseValue.getType()), rc, "type");
      isNotNullValuePut(toJSON(parseValue.getValues(), STRING, STRING, org.fusesource.restygwt.client.Json.Style.DEFAULT), rc, "values");
      isNotNullValuePut(STRING.encode(parseValue.getInstanceId()), rc, "instanceId");
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.workflow.WorkflowFieldDTO 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 decodeWorkflowFieldDTO107784722(object);
      }
      
      private org.silverpeas.mobile.shared.dto.workflow.WorkflowFieldDTO decodeWorkflowFieldDTO107784722(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.workflow.WorkflowFieldDTO rc = new org.silverpeas.mobile.shared.dto.workflow.WorkflowFieldDTO();
        rc.setActionName(getValueToSet(STRING.decode(object.get("actionName")), null));
        rc.setReadOnly(getValueToSet(BOOLEAN.decode(object.get("readOnly")), false));
        rc.setMandatory(getValueToSet(BOOLEAN.decode(object.get("mandatory")), false));
        rc.setDisplayerName(getValueToSet(STRING.decode(object.get("displayerName")), null));
        rc.setName(getValueToSet(STRING.decode(object.get("name")), null));
        rc.setLabel(getValueToSet(STRING.decode(object.get("label")), null));
        rc.setValue(getValueToSet(STRING.decode(object.get("value")), null));
        rc.setValueId(getValueToSet(STRING.decode(object.get("valueId")), null));
        rc.setType(getValueToSet(STRING.decode(object.get("type")), null));
        rc.setValues(getValueToSet(toMap(object.get("values"), STRING, STRING, org.fusesource.restygwt.client.Json.Style.DEFAULT), null));
        rc.setInstanceId(getValueToSet(STRING.decode(object.get("instanceId")), null));
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        return rc;
      }
      
    }
