code: @Override
      public WidgetData deserialize(JsonElement element, Type type, JsonDeserializationContext context)
          throws JsonParseException
      {
          JsonObject obj = element.getAsJsonObject();
  
          // Check for an event data source
          JsonElement nrql = obj.get("nrql");
          if(nrql != null)
              return gson.fromJson(obj, EventsData.class);
  
          // Check for a metric data source
          JsonElement duration = obj.get("duration");
          if(duration != null)
              return gson.fromJson(obj, MetricsData.class);
  
          // Check for a markdown data source
          JsonElement source = obj.get("source");
          if(source != null)
              return gson.fromJson(obj, MarkdownData.class);
  
          // Check for an inventory data source
          JsonElement sources = obj.get("sources");
          if(sources != null)
              return gson.fromJson(obj, InventoryData.class);
  
          return null;
      }
docs: Gson invokes this call-back method during deserialization when it encounters a field of the specified type.
  @param element The Json data being deserialized
  @param type The type of the Object to deserialize to
  @param context The JSON deserialization context
  @return The widget data