@@ -0,0 +1,1446 @@
+package com.bigcommerce.api;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0Aimport java.util.Map.Entry;%0A%0Aimport org.json.JSONException;%0Aimport org.json.JSONObject;%0A%0A/**%0A * Builds a JSON formatted String of the Form parameters.%0A * %0A * @author Jenith Michael Raj%0A * %0A */%0Apublic class Form %7B%0A%0A%09private Map%3CString, Object%3E parameters;%0A%0A%09private Form(Map%3CString, Object%3E parameters) %7B%0A%09%09this.parameters = parameters;%0A%09%7D%0A%0A%09public static Form create() %7B%0A%09%09return create(null);%0A%09%7D%0A%0A%09/**%0A%09 * Factory method, creates an instance of a filter. Used to build URLs to%0A%09 * collection endpoints.%0A%09 */%0A%09public static Form create(Map%3CString, Object%3E parameters) %7B%0A%09%09return (parameters == null) ? new Form(new HashMap%3CString, Object%3E())%0A%09%09%09%09: new Form(parameters);%0A%09%7D%0A%0A%09public %3CT%3E void addParam(String parameter, T value) %7B%0A%09%09this.parameters.put(parameter, value);%0A%09%7D%0A%0A%09/**%0A%09 * Converts the Form parameters into a JSON String that can be applied as%0A%09 * POST/PUT parameters.%0A%09 * %0A%09 * @return string%0A%09 */%0A%09public String toJson() %7B%0A%09%09String json = null;%0A%09%09try %7B%0A%09%09%09json = buildJson(this.parameters);%0A%09%09%7D catch (JSONException e) %7B%0A%09%09%09// TODO Log%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%09return (json != null) ? json : %22%22;%0A%09%7D%0A%0A%09private String buildJson(Map%3CString, Object%3E data) throws JSONException %7B%0A%09%09JSONObject json = new JSONObject();%0A%09%09for (Entry%3CString, Object%3E pair : data.entrySet()) %7B%0A%09%09%09json.put(pair.getKey(), pair.getValue());%0A%09%09%7D%0A%09%09%0A%09%09return json.toString();%0A%09%7D%0A%0A%7D%0A

Create Form: Update (PUT) a resource API call.