RequireSome Annotation

@RequireSome

The @RequireSome annotation is applied to a field annotated with @Option to indicate that at least one from some set of options must be specified e.g.

@Option(name = "--num",
        arity = 1,
        title = "Number")
@RequireSome(tag = "identifier")
private int number;

@Option(name = "--name",
        arity = 1,
        title = "Name")
@RequireSome(tag = "identifier")
private String name;

When fields are marked with @RequireSome if the user fails to supply at least one of the options that have the same tag value then an error will be thrown during parsing.

In this example the user must specify at least one of the --num or --name option and may specify both if desired.

If you want to require that at most one of some set of options be specified then you should use @RequireOnlyOne instead.

If you optionally want to allow only one from some set of options then you should use @MutuallyExclusiveWith.


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.