jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ignasi Barrera <notificati...@github.com>
Subject Re: [jclouds] JCLOUDS-1008: Add @Encoded annotation. (#861)
Date Mon, 19 Oct 2015 20:52:38 GMT
Thanks @timuralp. I see what you mean in the commit message. One thing that worries me about
this change is the number of places where the encoding happens in the rest annotation processor.
There are many places where this logic has to be taken into account, and that will make the
corre more error-prone and difficult to maintain.

What about a different approach: taking into account that [the values query parameter map
in the UriBuilder](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/http/Uris.java#L102)
are Objects and not simple Strings, and that those values are in the end [serialized using
their toString() method](https://github.com/timuralp/jclouds/blob/00242207f9c5d8b87e931bdc80a4c37c2752a686/core/src/main/java/org/jclouds/http/utils/Queries.java#L109-L144),
we could have an object, say `QueryValue`, that has the original value, a boolean saying if
it needs to be encoded or not, and a `toString()` method that properly serializes it taking
into account that flag.

This way, the RestAnnotationProcessor should only take care of generating QueryValue objects
for each query param, and all encoding logic remains in the UriBuilder and the Queries classes.
WDYT about exploring this approach?

Reply to this email directly or view it on GitHub:
View raw message