Package org.qdl_lang.scripting
Class JSONScriptUtil
- java.lang.Object
-
- org.qdl_lang.scripting.JSONScriptUtil
-
-
Field Summary
Fields Modifier and Type Field Description static StringSCRIPTS_TAG
-
Constructor Summary
Constructors Constructor Description JSONScriptUtil()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static net.sf.json.JSONObjectaddScript(net.sf.json.JSONObject scripts, net.sf.json.JSONObject j)Adds the already serialized script to the configuration object So first arg input isstatic net.sf.json.JSONObjectaddScript(net.sf.json.JSONObject scripts, QDLScript script)Add a singleQDLScriptto the set of JSON object of scripts.static net.sf.json.JSONObjectcreateConfig()Creates a brand new, empty scripts entry for the QDL configuration.static voidmain(String[] args)net.sf.json.JSONObjectremoveScript(net.sf.json.JSONObject scripts, String id)removes a script from a set with a given id.
-
-
-
Field Detail
-
SCRIPTS_TAG
public static String SCRIPTS_TAG
-
-
Method Detail
-
createConfig
public static net.sf.json.JSONObject createConfig()
Creates a brand new, empty scripts entry for the QDL configuration.- Returns:
-
addScript
public static net.sf.json.JSONObject addScript(net.sf.json.JSONObject scripts, QDLScript script)Add a singleQDLScriptto the set of JSON object of scripts. This gets (minimally){"scripts":[script,script,...]}(so if there are other tags, it ignores them and only works with this one tag) Note that it will replace the same named script.- Parameters:
scripts-script-
-
addScript
public static net.sf.json.JSONObject addScript(net.sf.json.JSONObject scripts, net.sf.json.JSONObject j)Adds the already serialized script to the configuration object So first arg input is{"key0":"value0","key1":"value1",...,"scripts":[ array of scripts ]}and the second argument is just a script to go the array{"script":{"id":..., ... }}This should only update the scripts' array- Parameters:
scripts-j-- Returns:
- updated first argument
-
removeScript
public net.sf.json.JSONObject removeScript(net.sf.json.JSONObject scripts, String id)removes a script from a set with a given id. So input is{"scripts":{[ {"script":{"id0":...}}, {"script":{"id1":...}}, {"script":{"id2":...}},... ]}}And if e.g. "id1" is passed in, it is removed.- Parameters:
scripts-id-
-
main
public static void main(String[] args)
-
-