Package org.qdl_lang.scripting
Class JSONScriptUtil
- java.lang.Object
- 
- org.qdl_lang.scripting.JSONScriptUtil
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringSCRIPTS_TAG
 - 
Constructor SummaryConstructors Constructor Description JSONScriptUtil()
 - 
Method SummaryAll 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_TAGpublic static String SCRIPTS_TAG 
 
- 
 - 
Method Detail- 
createConfigpublic static net.sf.json.JSONObject createConfig() Creates a brand new, empty scripts entry for the QDL configuration.- Returns:
 
 - 
addScriptpublic 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-
 
 - 
addScriptpublic 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
 
 - 
removeScriptpublic 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-
 
 - 
mainpublic static void main(String[] args) 
 
- 
 
-