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

Change ArgSpec::setValue to ::addValue #302

Closed
remkop opened this issue Mar 19, 2018 · 1 comment
Closed

Change ArgSpec::setValue to ::addValue #302

remkop opened this issue Mar 19, 2018 · 1 comment
Labels
status: declined ❌ A suggestion or change that we don't feel we should currently apply type: API 🔌

Comments

@remkop
Copy link
Owner

remkop commented Mar 19, 2018

...and move the logic that initializes arrays, collections and Maps from the Interpreter class to the model.

Related to #182 (support annotating methods with @Option and @Parameters):

@Option(name = "-x", description = "Getter method returns mutable list")
List<Integer> getIntegers() { ... }

@Option(name = "-y", description = "Setter method replaces full collection")
void setLongs(List<Long> values) { ... }

@Option(name = "-z", description = "Mutator method adds single value")
void addDouble(double dbl) { ... }

For maps, adding individual key-value pairs as they are found on the command line is more complex:

@Option(name = "-a", description = "Getter method returns mutable map")
Map<Integer, String> getIntegers() { ... }

@Option(name = "-b", description = "Setter method replaces full collection")
void setLongs(Map<Long, String> values) { ... }

@Option(name = "-c", description = "Mutator method adds single value")
void addShort(short shrt, String value) { ... }
@remkop remkop added this to the 3.0 milestone Mar 19, 2018
@remkop
Copy link
Owner Author

remkop commented Apr 11, 2018

Based on experience with rewriting groovy.util.CliBuilder based on picocli (#258), there is no need for this API change. #182 can be implemented with IGetter and ISetter implementations that bind the option or positional parameter to a method invocation. Details are on the #182 ticket.

@remkop remkop closed this as completed Apr 11, 2018
@remkop remkop removed this from the 3.0 milestone Apr 11, 2018
@remkop remkop added the status: declined ❌ A suggestion or change that we don't feel we should currently apply label Apr 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined ❌ A suggestion or change that we don't feel we should currently apply type: API 🔌
Projects
None yet
Development

No branches or pull requests

1 participant