aesteve / nubes

Annotation layer on top of Vert.x 3
Apache License 2.0
120 stars 35 forks source link

Use a functional approach #70

Open aesteve opened 7 years ago

aesteve commented 7 years ago

To open the door to this proposal, start a proof of concept within Nubes to map any @FunctionalInterface as a  Handler with "magic" parameter injection.

Cannot be achieved as is since lambdas are not "methods" (when introspected at runtime).

Maybe compilation processing could be involved so that if a "resolving class" is annotated properly, then the code to create a Handler from it is automatically generated.

That'd be great to introduce type safety i.e. : you're trying to use a BiConsumer<String, Foo> as a Handler<RoutingContext> but I don't know how to map Foo from the RoutingContext.