I've been trying out Retrofit and I really it's simplicity.
However I have an otimization concern. I'm using Parse for my backend and it has a pure Rest API.
When I want to update an object I use a PUT HTTP Request and pass in the body only the specific values I want to update.
However, using Retrofit I always have to serialize the entire object when passing it using the @Body annotation. If I have a very large object, this is very inneficient.
All the solutions I see is using Annotations to inform the Converter which fields are exposed. However this affects all requests and won't work if I have different update methods for updating different fields.
I think I have two options:
- Pass the parameters I want to update as
Formparameters and use the@URLEncodedannotation. However this is not reallyRESTfuland I don't thinkParsesupports it. - Create an annotation to inform which fields should be added to
JSONin thebody. For doing this, how can I access the method's annotations in the Converter, in order to select which fields to serialize?