i.e.
@GET(url="http://host/users/$userid") public abstract User getUser(String userid)
isn't that much easier than the python requests version but much harder if you need to add a custom dynamic header to the call.
i.e.
@GET(url="http://host/users/$userid") public abstract User getUser(String userid)
isn't that much easier than the python requests version but much harder if you need to add a custom dynamic header to the call.
That seems like an easy problem to solve. Don't use annotations.
Snark aside, it can be a bit of a tricky balancing act. When there are more annotations than actual code, that's a code smell in my book and something needs to change. Separating concerns usually does the trick. I'm heavy on code generation, so anything that's boring enough to benefit from oodles of annotations will probably end up getting generated based on a 2 line config file or something.
Switching to / mixing in Kotlin is worth it just for the data classes at this point (and you get some type-level nullability and `val` instead of `final var` to boot).
Then you can create a standard immutable class with a constructior, and Jackson's object mapper can then serialize and deserialize.
The only catch is that you must add -parameters to your javac args.
Compile time dependency injection (Micronaut framework).
Not something I have a use for but it's clever.
Its just: @RequestHeader("Header") added to the param list.
>@Context HttpHeaders headers
I'm not sure if there's some kind of regex support or anything like that. Looping through the headers seems simple enough.