Hi, I built a small library for Android, it helps ...
# android
Hi, I built a small library for Android, it helps you to add custom annotations on retrofit calls and retrieve them later via interceptor Check it out and give me your feedback https://t.co/FF72E0GR1s
👀 1
👍 1
🙂 1
I think there is an easier way. but i have not played with it yet. Retrofit adds an implicit
that has a reference to the
at which point you can query for custom annotations via the normal reflection api's. All of which can be done in an interceptor without the need for a custom call adapter factory.
Been meaning to POC this out. let me see what I can throw together today and i'll post back here
👍 1
single base class that is pretty damn simple. then the test file has an example use-case
something wrong in the way I am mutating the request but proves that it at least picked up the annotation and tried to muck with it
very cool that's a better and simpler way to do it 👏
i wasn't aware that retrofit add
Tag to all its requests
I knew about tag. but Jesse wilson is who got me thinking about how to do some of this easier. https://twitter.com/jessewilson/status/1231569857986035712
only other note i'd add about that, is the call to
might be expensive and worth caching in a map. ie
val annotationCache: MutableMap<Method, T>
where T is the annotation.
👍 1
yes totally agree caching annotation worth it