I am using the below code to fetch info from workitem
MetaDataMap inputMap = workItem.getMetaDataMap();
String[] customList = (String[]) inputMap.get("customList");
The "customList" is a textfield defined as multifield -
<customList
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
name="customList"/>
</customList>
this throws a class cast exception when only value is configured in the multifield.
java.lang.ClassCastException: class java.lang.String cannot be cast to class [Ljava.lang.String
this is because of the (String[]) casting. what will be the best way to correct it for both String and String[]?