Hints source code generator (jooby annotation processor) to map/adapt a specific return type to use a custom
handler. This annotation if only for source code generator process so only applies for MVC routes.
Example:
class MyController {
@GET("/")
public MySpecialType hello() {}
}
}
Write a code generator:
@ResultType(types = MySpecialType.class, handler = "customMapping")
class MySpecialTypeGenerator {
public static Route.Handler customMapping(Route.Handler handler) {
return myHandler.then(handler);
}
}
Let jooby annotation processor to know about your handler by setting the jooby.handler annotation processor option:
jooby.handler=mypackage.MySpecialTypeGenerator
Generates:
app.get("/", customMapping(this::hello));
This new annotation replaces the existing ResultHandler supports which works at runtime, while this one works at compile time.
Hints source code generator (jooby annotation processor) to map/adapt a specific return type to use a custom handler. This annotation if only for source code generator process so only applies for MVC routes. Example:
Let jooby annotation processor to know about your handler by setting the
jooby.handler
annotation processor option:jooby.handler=mypackage.MySpecialTypeGenerator
Generates:
This new annotation replaces the existing ResultHandler supports which works at runtime, while this one works at compile time.
see #3422