I'm using JCommander v. 1.72 and my aim is to get a (comma-seperated) list of strings in a parameter and validate the single strings. Sounds simple, right?
Here is my code:
@Parameter(names = { "-sort", "-s" }, validateWith = ParameterValidatorHeader.class)
private List<String> sort = new ArrayList<String>();
I run the programm with this command:
-sort column1,column2
I expected that JCommander would call the validator after splitting on the single items, i.e. validate "column1", validate "column2". But obviously the string "column1,column2" is sent to the validator class before splitting the parameter value.
How can I achieve to do the validation on the single items instead? (Sure, I could do the validation with pure Java after parsing them with JCommander...)
Thanks Erich