Skip to content

Support default value and custom converter for individual options/parameters #1308

@asarkar

Description

@asarkar

Currently, the default value and custom converter can only be specified at the class level, which is not useful at all for the following reasons:

  1. IDefaultValueProvider returns a String, not the actual field type.
  2. It is cumbersome to use IDefaultValueProvider to provide default values for multiple fields.
  3. Custom converter is useless when the same source type (string) needs to be converted to different target types.

Being able to provide a default value provider class and a converter class in the Option (and Parameter) annotation would be extremely useful. The default value provider may return a type that can be converted to the field type using the available converters (including the inline one).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions