private HttpServlet servletForDeducedSignatureType()

in invoker/core/src/main/java/com/google/cloud/functions/invoker/runner/Invoker.java [379:399]


  private HttpServlet servletForDeducedSignatureType(Class<?> functionClass) {
    if (HttpFunction.class.isAssignableFrom(functionClass)) {
      return HttpFunctionExecutor.forClass(functionClass);
    }
    if (TypedFunction.class.isAssignableFrom(functionClass)) {
      return TypedFunctionExecutor.forClass(functionClass);
    }
    Optional<BackgroundFunctionExecutor> maybeExecutor =
        BackgroundFunctionExecutor.maybeForClass(functionClass);
    if (maybeExecutor.isPresent()) {
      return maybeExecutor.get();
    }
    String error =
        String.format(
            "Could not determine function signature type from target %s. Either this should be a"
                + " class implementing one of the interfaces in com.google.cloud.functions, or the"
                + " environment variable FUNCTION_SIGNATURE_TYPE should be set to \"http\" or"
                + " \"event\".",
            functionTarget);
    throw new RuntimeException(error);
  }