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

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

public class HyperLinkDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.hyperlink.HyperLinkDTO> {
  
  public static final HyperLinkDTO_Generated_JsonEncoderDecoder_ INSTANCE = new HyperLinkDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.hyperlink.HyperLinkDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeHyperLinkDTO890381628(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeHyperLinkDTO890381628( org.silverpeas.mobile.shared.dto.hyperlink.HyperLinkDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.hyperlink.HyperLinkDTO parseValue = (org.silverpeas.mobile.shared.dto.hyperlink.HyperLinkDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getUrl()), rc, "url");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getOpenNewWindow()), rc, "openNewWindow");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getInternalLink()), rc, "internalLink");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.hyperlink.HyperLinkDTO 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 decodeHyperLinkDTO890381628(object);
      }
      
      private org.silverpeas.mobile.shared.dto.hyperlink.HyperLinkDTO decodeHyperLinkDTO890381628(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.hyperlink.HyperLinkDTO rc = new org.silverpeas.mobile.shared.dto.hyperlink.HyperLinkDTO();
        rc.setUrl(getValueToSet(STRING.decode(object.get("url")), null));
        rc.setOpenNewWindow(getValueToSet(BOOLEAN.decode(object.get("openNewWindow")), false));
        rc.setInternalLink(getValueToSet(BOOLEAN.decode(object.get("internalLink")), false));
        return rc;
      }
      
    }
