code: public IncomingMessage deserialize(JsonElement json, Type typeOfT,
  			JsonDeserializationContext context) throws JsonParseException {
  		JsonElement isEchoElement = json.getAsJsonObject().get("is_echo");
  		boolean isEcho = isEchoElement != null ? isEchoElement.getAsBoolean() : false;
  		Class<? extends IncomingMessage> incomingMessageClass = null;
  		if (isEcho == true) {
  			incomingMessageClass = EchoMessage.class;
  		} else {
  			incomingMessageClass = ReceivedMessage.class;
  		}
  		return context.deserialize(json, incomingMessageClass);
  	}
docs: /*
  (non-Javadoc)
  
  @see
  com.google.gson.JsonDeserializer#deserialize(com.google.gson.JsonElement,
  java.lang.reflect.Type, com.google.gson.JsonDeserializationContext)