required = builder.required;
defvalue = builder.defaultValue;
value = builder.value;
- possibleVals = new ArrayList<>(builder.possibleValues);
- displayVals = new ArrayList<>(
- requireNonNullElse(builder.displayValues, possibleVals));
+ if (builder.possibleValues != null)
+ possibleVals = new ArrayList<>(builder.possibleValues);
+ if (builder.displayValues != null)
+ displayVals = new ArrayList<>(builder.displayValues);
+ else
+ displayVals = possibleVals;
+ if (possibleVals == null && displayVals != null)
+ throw new IllegalArgumentException(
+ "cannot use displayValues if possibleValues is null");
+ if (possibleVals != null && possibleVals.size() != displayVals.size())
+ throw new IllegalArgumentException(
+ "displayValues size does not match possibleValues");
fdetails = builder.detailsUrl;
}
else if (param instanceof Parameter.ChoiceParameter)
{
Object ovalue = values.get(param.getId());
- List<String> lvalue = param.isArray() ? (List<String>) ovalue : List.of((String) ovalue);
+ List<String> lvalue = null;
+ if (param.isArray())
+ lvalue = (List<String>) ovalue;
+ else if (ovalue != null)
+ lvalue = List.of((String) ovalue);
args.addAll(createChoiceOptions((Parameter.ChoiceParameter) param, lvalue));
}
else if (param instanceof Parameter.FileParameter)