commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Oxspring" <roxspr...@imapmail.org>
Subject [CLI][PATCH] Min and Max size for arguments
Date Tue, 10 Jun 2003 17:40:36 GMT
Attached is a patch that allows arguments to have specified a minimum and maximum number of
values rather than just the previous
"size".  An example of use might be where you are selecting a number of files for an operation
but want to ensure that at least one
value was specified:

        options.add(
            ArgumentBuilder
                .createBuilder()
                .withLongName("search-location")
                .withMinimumSize(1)
                .withMaximumSize(100)
                .withValueName("directory")
                .create());

ArgumentBuilder.withSize(int) has been retained and sets both min and max to the same.  (This
might be a bad thing if both size and
min/max are specified though).

ArgumentBuilder.withOptionalValues(boolean) has been removed since its a function of the min
and max values.

Argument.hasOptionalValues() has been retained and returns min<max

Argument.getSize() has been removed and getMaximumSize() or getMinimumSize() should be used
instead.

Thoughts welcome.  If you want me to commit it myself then I'll need access to jakarta-commons
first.

Rob

Oh - and the extra testcase needs the apache licence attached, whoops.

Mime
View raw message