jcommander
jcommander copied to clipboard
@SubParameter Problems
There are at least 2 problems with @SubParameter
- It can set only
publicfields of a class - It does not convert data types
Example code:
public class TuneOptions {
@Parameter(names = "--tune", arity = 4, required = true)
private TuneVariable tuneVariable;
public static class TuneVariable {
@SubParameter(order = 0)
public String variableName;
@SubParameter(order = 1)
public double min;
@SubParameter(order = 2)
public double max;
@SubParameter(order = 3)
public double step;
}
}
In the above code:
variableName, min, max, stephave to bepublic(otherwise there is an exception) which is not good and is different from usual jCommander behavior- Parameters like
--tune L 0 1 0.01yield exception as0is treated as string and is not converted todouble
I'd like to work on this