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

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

public class PresenceStatusDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.almanach.PresenceStatusDTO> {
  
  public static final PresenceStatusDTO_Generated_JsonEncoderDecoder_ INSTANCE = new PresenceStatusDTO_Generated_JsonEncoderDecoder_();
  
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.almanach.PresenceStatusDTO value) {
    if( value==null ) {
      return com.google.gwt.json.client.JSONNull.getInstance();
    }
    return new com.google.gwt.json.client.JSONString(value.name());
  }
  
  
  public PresenceStatusDTO 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.PresenceStatusDTO v: org.silverpeas.mobile.shared.dto.almanach.PresenceStatusDTO.values()) {
      if(v.name().equals(str.stringValue())) {
        return v;
      }
    }
    throw new DecodingException("can not find enum for given value: "+str.stringValue());
  }
  
}
