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

Use type attribute to determine conversion target type instead of field type #197

Closed
remkop opened this issue Oct 2, 2017 · 0 comments
Closed

Comments

@remkop
Copy link
Owner

remkop commented Oct 2, 2017

This allows fields to be declared as interface or abstract types, and picocli can still convert string command line args to the concrete implementation class specified in the type attribute.

Example:

class App {
    @Option(names = "--num", type = BigDecimal.class) // subclass of field type
    Number[] number; // array type with abstract component class

    @Parameters(type = JapaneseAddress.class) // concrete impl class
    IAddress address; // type declared as interface
}

If the type attribute is not specified, fall back to the array component class or (for single-value fields) the field type.

@remkop remkop added this to the 2.0.0 milestone Oct 2, 2017
remkop added a commit that referenced this issue Oct 2, 2017
…use `type` attribute to determine conversion target type instead of field type
@remkop remkop closed this as completed in 88b97fe Oct 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant