I think the cleanest way will be to create your own 
[MapBinder](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/rest/MapBinder.java):
 You'll have to create a class that implements that interface (usually also 
subclassing the 
[BindToJsonPayload](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/rest/binders/BindToJsonPayload.java)
 class), and then remove the `@Payload` annotation from the api method and add 
the following one (the `@Payload` annotations in the method parameters should 
remain there):
```java
@MapBinder(YourCustomBinder.class)
```
Implementing the binder is pretty straightforward. The method will receive a 
map already populated with the keys (defined in the `@Payload` annotations in 
the parameters) and the corresponding values; you just need to manually 
generate the payload string. You can take a look at [some existing 
binders](https://github.com/jclouds/jclouds/tree/master/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/binders)
 in the openstack-nova api to see some examples of how they work.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/339#issuecomment-41508510

Reply via email to