package org.silverpeas.mobile.shared.dto;

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

public class RightDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.RightDTO> {
  
  public static final RightDTO_Generated_JsonEncoderDecoder_ INSTANCE = new RightDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.RightDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeRightDTO458410220(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeRightDTO458410220( org.silverpeas.mobile.shared.dto.RightDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.RightDTO parseValue = (org.silverpeas.mobile.shared.dto.RightDTO)value;
      isNotNullValuePut(BOOLEAN.encode(parseValue.getReader()), rc, "reader");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getWriter()), rc, "writer");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getPublisher()), rc, "publisher");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getManager()), rc, "manager");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.RightDTO 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 decodeRightDTO458410220(object);
      }
      
      private org.silverpeas.mobile.shared.dto.RightDTO decodeRightDTO458410220(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.RightDTO rc = new org.silverpeas.mobile.shared.dto.RightDTO();
        rc.setReader(getValueToSet(BOOLEAN.decode(object.get("reader")), false));
        rc.setWriter(getValueToSet(BOOLEAN.decode(object.get("writer")), false));
        rc.setPublisher(getValueToSet(BOOLEAN.decode(object.get("publisher")), false));
        rc.setManager(getValueToSet(BOOLEAN.decode(object.get("manager")), false));
        return rc;
      }
      
    }
