MinOccurrences Annotation

@MinOccurrences

The @MinOccurrences annotation is used to indicate that an @Option or @Arguments may be specified at least some number of times.

@Option(name = "--name",
        arity = 1,
        title = "Name")
@MinOccurrences(occurrences = 2)
private List<String> name;

Here we specify that the --name option must be provided at least twice. If the option is not provided enough times an error will be thrown during parsing.

To specify the maximum number of occurrences use the @MaxOccurrences annotation.

If you want an option to occur only once then use the @Once annotation, if you want to require that the option occur then use the @Required annotation.


Improving this Documentation

This documentation is itself open source and lives in GitHub under the docs/ directory.

I am not a professional technical writer and as the developer of this software I can often make assumptions of knowledge that you as a user reading this may not have. Improvements to the documentation are always welcome, if you have suggestions for the documentation please submit pull requests to the main branch.