Description
Use case: Create a lambda function that handles different event types
The handler class has to implement the RequestHandler interface with <T,String>, being T one of the event types. As those do not share a common ancestory type, we need to implement the handling of each event type as a separa te class, and hence a separate Lambda. Having a common ancestor type would allow to implement RequestHandler<LambdaEventAbstractType,String> and determine in the handler function the type of event by inspecting its class with event.getClass().
This would also be a more Object oriented design, with a group of closely related types having a common ancestor.
We can now do something similar by implementing RequestHandler<Object,String> but it is poorer design and too loose in terms of type control.