I am very new to the Clover
How to set a Value in a Dictionary which type is a Map.
How can i insert a key say ''retry" and the value into it , I am using JavaCustomComponent ,
How can i do it in Java ?
Thanks,
I am very new to the Clover
How to set a Value in a Dictionary which type is a Map.
How can i insert a key say ''retry" and the value into it , I am using JavaCustomComponent ,
How can i do it in Java ?
Thanks,
Hi,
The common syntax in CTL would look like this:
dictionary.myEntry["retry"] = "myValue";
When you type this into a CTL editor, you have an option to convert your CTL code into Java code, see the screenshot.
convert.png
Converting the CTL code above, you will get the following:
java.util.Map<java.lang.String,java.lang.String> tmpVar0 = CTLUtils.toMap(getGraph().getDictionary().getValue("myEntry"), java.lang.String.class);
boolean tmpVar1 = false;
if (tmpVar0 == null) {
tmpVar0 = new java.util.LinkedHashMap<java.lang.String,java.lang.String>();
tmpVar1 = true;
}
tmpVar0.put("retry", "myValue");
if (tmpVar1) {
getGraph().getDictionary().setValue("myEntry", tmpVar0);
}
Hope this helps.
Thanks ,really helped.