All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.chargebee.internal.CompositeParameter Maven / Gradle / Ivy

There is a newer version: 3.26.0
Show newest version
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));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy