com.chargebee.internal.CompositeParameter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chargebee-java Show documentation
Show all versions of chargebee-java Show documentation
Java client library for ChargeBee API
package com.chargebee.internal;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
public class CompositeParameter extends Parameter {
String nestedParameterName;
public CompositeParameter(String name, String nestedParameterName) {
this.name = name;
this.nestedParameterName = nestedParameterName;
}
@Override
Map toFormURLEncoded(Map paramsMap) {
return new HashMap() {{
put(name + "[" + nestedParameterName + "]", value);
}};
}
@Override
JSONObject toJSONBody(JSONObject paramsJSON) {
return paramsJSON.put(name, new JSONObject().put(nestedParameterName, value));
}
}