static Event convertToLegacyEvent()

in invoker/core/src/main/java/com/google/cloud/functions/invoker/CloudEvents.java [102:109]


  static Event convertToLegacyEvent(CloudEvent cloudEvent) {
    String eventType = cloudEvent.getType();
    EventAdapter eventAdapter = EVENT_TYPE_MAPPING.get(eventType);
    if (eventAdapter == null) {
      throw new IllegalArgumentException("Unrecognized CloudEvent type \"" + eventType + "\"");
    }
    return eventAdapter.convertToLegacyEvent(cloudEvent);
  }