Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@SubParameter Problems #486

Open
antonio-rodriges opened this issue May 31, 2020 · 1 comment · May be fixed by #515
Open

@SubParameter Problems #486

antonio-rodriges opened this issue May 31, 2020 · 1 comment · May be fixed by #515
Labels
bug Bug

Comments

@antonio-rodriges
Copy link

There are at least 2 problems with @SubParameter

  1. It can set only public fields of a class
  2. 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:

  1. variableName, min, max, step have to be public (otherwise there is an exception) which is not good and is different from usual jCommander behavior
  2. Parameters like --tune L 0 1 0.01 yield exception as 0 is treated as string and is not converted to double
@fsd654qyl
Copy link
Contributor

I'd like to work on this

@fsd654qyl fsd654qyl linked a pull request Apr 26, 2021 that will close this issue
@mkarg mkarg added the bug Bug label Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants