I'm working on my bulk builder plugin which enables users to, for example, build all jobs or build all failed jobs. I'm adding support for paramterised jobs and have added a single textbox named "params" where users should enter parameters in the format,
Then when the form is submitted, the params value is converted into a Map<String, String> object. When looping over the jobs to be built, any parameterised jobs which have matching parameter names in the map have the value passed to createValue(String value). The problem I have with this approach is createValue(String value) is not defined in the abstrac ParameterDefinition class. This means first casting to, for example, StringParameterDefinition before calling createValue(). This is really hacky and means updating the plugin if new parameter definition types are added.
Instead I'd prefer to use the ParameterValue.createValue(StaplerRequest req, JSONObject jo) abstract method, but I can't figure out how to do this using just one textbox. Could someone give me some pointers please? I'm reluctant to have multiple textboxes as I feel this would clutter the UI.