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

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

public class ParticipationStatusDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.almanach.ParticipationStatusDTO> {
  
  public static final ParticipationStatusDTO_Generated_JsonEncoderDecoder_ INSTANCE = new ParticipationStatusDTO_Generated_JsonEncoderDecoder_();
  
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.almanach.ParticipationStatusDTO value) {
    if( value==null ) {
      return com.google.gwt.json.client.JSONNull.getInstance();
    }
    return new com.google.gwt.json.client.JSONString(value.name());
  }
  
  
  public ParticipationStatusDTO decode(com.google.gwt.json.client.JSONValue value) {
    if( value == null || value.isNull()!=null ) {
      return null;
    }
    com.google.gwt.json.client.JSONString str = value.isString();
    if( null == str ) {
      throw new DecodingException("Expected a json string (for enum), but was given: "+value);
    }
    for(org.silverpeas.mobile.shared.dto.almanach.ParticipationStatusDTO v: org.silverpeas.mobile.shared.dto.almanach.ParticipationStatusDTO.values()) {
      if(v.name().equals(str.stringValue())) {
        return v;
      }
    }
    throw new DecodingException("can not find enum for given value: "+str.stringValue());
  }
  
}
