JEP 445 (Preview in JDK 21) introduces unnamed classes and instance main methods. This could be a boon to writing functions if done right changing our result from this:
packagecom.example;
importcom.google.cloud.functions.HttpFunction;
importcom.google.cloud.functions.HttpRequest;
importcom.google.cloud.functions.HttpResponse;
publicclassHelloWorldimplementsHttpFunction {
@Overridepublicvoidservice(HttpRequestrequest, HttpResponseresponse)
throwsException {
response.getWriter().write("Hello, World\n");
}
}To something like this:
importcom.google.cloud.functions.FuncFramework;
voidmain() {
FuncFramework.http((req, res) -> response.getWriter().write("Hello, World\n"));
}
JEP 445 (Preview in JDK 21) introduces unnamed classes and instance main methods. This could be a boon to writing functions if done right changing our result from this:
To something like this: