Skip to content

Commit 1e6aa8c

Browse files
committed
Complete javadoc, fix typos, fix findbugs warning: make comparator serializable.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/trunk@1439414 13f79535-47bb-0310-9956-ffa450edef68
1 parent f481ae3 commit 1e6aa8c

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/main/java/org/apache/commons/cli/HelpFormatter.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.io.BufferedReader;
2121
import java.io.IOException;
2222
import java.io.PrintWriter;
23+
import java.io.Serializable;
2324
import java.io.StringReader;
2425
import java.util.ArrayList;
2526
import java.util.Arrays;
@@ -364,6 +365,7 @@ public String getArgName()
364365
* Comparator used to sort the options when they output in help text.
365366
* Defaults to case-insensitive alphabetical sorting by option key.
366367
*
368+
* @return the {@link Comparator} currently in use to sort the options
367369
* @since 1.2
368370
*/
369371
public Comparator<Option> getOptionComparator()
@@ -375,6 +377,7 @@ public Comparator<Option> getOptionComparator()
375377
* Set the comparator used to sort the options when they output in help text.
376378
* Passing in a null comparator will keep the options in the order they were declared.
377379
*
380+
* @param comparator the {@link Comparator} to use for sorting the options
378381
* @since 1.2
379382
*/
380383
public void setOptionComparator(Comparator<Option> comparator)
@@ -465,7 +468,7 @@ public void printHelp(int width, String cmdLineSyntax, String header, Options op
465468
*
466469
* @param width the number of characters to be displayed on each line
467470
* @param cmdLineSyntax the syntax for this application
468-
* @param header the banner to display at the begining of the help
471+
* @param header the banner to display at the beginning of the help
469472
* @param options the Options instance
470473
* @param footer the banner to display at the end of the help
471474
* @param autoUsage whether to print an automatically generated
@@ -487,7 +490,7 @@ public void printHelp(int width, String cmdLineSyntax, String header,
487490
* @param pw the writer to which the help will be written
488491
* @param width the number of characters to be displayed on each line
489492
* @param cmdLineSyntax the syntax for this application
490-
* @param header the banner to display at the begining of the help
493+
* @param header the banner to display at the beginning of the help
491494
* @param options the Options instance
492495
* @param leftPad the number of characters of padding to be prefixed
493496
* to each line
@@ -1053,8 +1056,11 @@ protected String rtrim(String s)
10531056
* This class implements the <code>Comparator</code> interface
10541057
* for comparing Options.
10551058
*/
1056-
private static class OptionComparator implements Comparator<Option>
1059+
private static class OptionComparator implements Comparator<Option>, Serializable
10571060
{
1061+
/** The serial version UID. */
1062+
private static final long serialVersionUID = 5305467873966684014L;
1063+
10581064
/**
10591065
* Compares its two arguments for order. Returns a negative
10601066
* integer, zero, or a positive integer as the first argument

0 commit comments

Comments
 (0)