@UsesCookie
public void myMethod(RoutingContext context) {
routingContext.getCookie("bleh");
}
That's probably not consistent with dependency injection used everywhere else.
Keep this annotation if some user just wants to set a cookie but won't read any (and rename it @SetsCookie ?)
Moreover provide another annotation :
public void myMethod(@Cookie("myCookie") Cookie cookie)
If the parameter type is Cookie then simply inject context.getCookie(annotation.value()) else if it's a String inject context.getCookie(annotation.value())?.value()
Existing now :
That's probably not consistent with dependency injection used everywhere else.
Keep this annotation if some user just wants to set a cookie but won't read any (and rename it
@SetsCookie
?)Moreover provide another annotation :
If the parameter type is
Cookie
then simply injectcontext.getCookie(annotation.value())
else if it's a String injectcontext.getCookie(annotation.value())?.value()