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

Refactor how option restrictions are implemented #25

Closed
rvesse opened this issue Jul 23, 2015 · 1 comment
Closed

Refactor how option restrictions are implemented #25

rvesse opened this issue Jul 23, 2015 · 1 comment

Comments

@rvesse
Copy link
Owner

rvesse commented Jul 23, 2015

Currently we support two kinds of option restrictions:

  • Marking them as required
  • Marking them as having allowedValues i.e. restricted set of values

Ideally we'd like to support a wider range of restrictions e.g.

  • Marking options as mutually exclusive with other options
  • Required if other options are present i.e. requirement dependencies
  • Range restrictions (min and max values)

Rather than keep adding stuff to the @Option annotation it would be better to create a new @OptionRestriction annotation (and sub-classes thereof) which would be used to annotate fields to indicate restrictions that apply. These could then be discovered via reflection and added to the OptionMetadata for an option.

rvesse added a commit that referenced this issue Jul 23, 2015
- Define first draft interfaces
- Start attempting basic implementations
rvesse added a commit that referenced this issue Jul 24, 2015
- Move annotations into own packages
- Define factory classes
- Add factory registry
rvesse added a commit that referenced this issue Jul 24, 2015
- Remove defunct fields from @option and @arguments
- Add restrictions to metadata classes
- Load restrictions in metadata loader
rvesse added a commit that referenced this issue Jul 27, 2015
Most existing code switched over to use the new restrictions
framework and all existing tests passing

Examples updated to use new annotations for declaring additional
restrictions
rvesse added a commit that referenced this issue Jul 27, 2015
Switches over the CliParser and SingleCommandParser to support using
GlobalRestriction to enforce global restrictions.  Changed SingleCommand
and CliBuilder to allow specifying custom restrictions as desired.
rvesse added a commit that referenced this issue Jul 27, 2015
- Various tests for @IntegerRange
- Fix bug in error messages generated by RangeRestriction
- Add tests for restriction inheritance behaviour
rvesse added a commit that referenced this issue Jul 27, 2015
Updates the Migration notes to reflect the various changes introduced by
the new restrictions framework.
@rvesse
Copy link
Owner Author

rvesse commented Jul 28, 2015

This is implemented but not yet merged into the 2.x branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant