LengthRange Annotation

@LengthRange

The @LengthRange annotation may be applied to fields annotated with @Option and @Arguments to limit the length of values that an option may be used with to a range of lengths e.g.

@Option(name = "--reference", arity = 1)
@LengthRange(min = 5, max = 10)
private String reference;

This specifies that the --reference option only allows values with lengths of 5 to 10 characters to be specified by the user. Any other length value will be rejected.

If you have an exact length to enforce then you should use the @ExactLength annotation. If you want to restrict just the minimum/maximum length of a value then use the @MinLength or @MaxLength annotations.cd


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.