Skip to content

Commit 472bdd5

Browse files
committed
Javadoc
Reduce vertical whitespace
1 parent 95f2d83 commit 472bdd5

15 files changed

Lines changed: 154 additions & 169 deletions

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public class AlreadySelectedException extends ParseException {
3636
/**
3737
* Constructs a new {@code AlreadySelectedException} for the specified option group.
3838
*
39-
* @param optionGroup the option group already selected
40-
* @param option the option that triggered the exception
39+
* @param optionGroup the option group already selected.
40+
* @param option the option that triggered the exception.
4141
* @since 1.2
4242
*/
4343
public AlreadySelectedException(final OptionGroup optionGroup, final Option option) {
@@ -48,7 +48,7 @@ public AlreadySelectedException(final OptionGroup optionGroup, final Option opti
4848
/**
4949
* Constructs a new {@code AlreadySelectedException} with the specified detail message.
5050
*
51-
* @param message the detail message
51+
* @param message the detail message.
5252
*/
5353
public AlreadySelectedException(final String message) {
5454
this(message, null, null);
@@ -63,7 +63,7 @@ private AlreadySelectedException(final String message, final OptionGroup optionG
6363
/**
6464
* Gets the option that was added to the group and triggered the exception.
6565
*
66-
* @return the related option
66+
* @return the related option.
6767
* @since 1.2
6868
*/
6969
public Option getOption() {
@@ -73,7 +73,7 @@ public Option getOption() {
7373
/**
7474
* Gets the option group where another option has been selected.
7575
*
76-
* @return the related option group
76+
* @return the related option group.
7777
* @since 1.2
7878
*/
7979
public OptionGroup getOptionGroup() {

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ private static String createMessage(final String option, final Collection<String
4242
final StringBuilder buf = new StringBuilder("Ambiguous option: '");
4343
buf.append(option);
4444
buf.append("' (could be: ");
45-
4645
final Iterator<String> it = matchingOptions.iterator();
4746
while (it.hasNext()) {
4847
buf.append(Char.APOS);
@@ -53,7 +52,6 @@ private static String createMessage(final String option, final Collection<String
5352
}
5453
}
5554
buf.append(")");
56-
5755
return buf.toString();
5856
}
5957

@@ -63,8 +61,8 @@ private static String createMessage(final String option, final Collection<String
6361
/**
6462
* Constructs a new AmbiguousOptionException.
6563
*
66-
* @param option the partial option name
67-
* @param matchingOptions the options matching the name
64+
* @param option the partial option name.
65+
* @param matchingOptions the options matching the name.
6866
*/
6967
public AmbiguousOptionException(final String option, final Collection<String> matchingOptions) {
7068
super(createMessage(option, matchingOptions), option);
@@ -74,7 +72,7 @@ public AmbiguousOptionException(final String option, final Collection<String> ma
7472
/**
7573
* Gets the options matching the partial name.
7674
*
77-
* @return a collection of options matching the name
75+
* @return a collection of options matching the name.
7876
*/
7977
public Collection<String> getMatchingOptions() {
8078
return matchingOptions;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
2121
* The class BasicParser provides a very simple implementation of the {@link Parser#flatten(Options,String[],boolean)
2222
* flatten} method.
2323
*
24-
* @deprecated since 1.3, use the {@link DefaultParser} instead
24+
* @deprecated since 1.3, use the {@link DefaultParser} instead.
2525
*/
2626
@Deprecated
2727
public class BasicParser extends Parser {
@@ -43,14 +43,14 @@ public BasicParser() {
4343
* <strong>Note:</strong> {@code options} and {@code stopAtNonOption} are not used in this {@code flatten} method.
4444
* </p>
4545
*
46-
* @param options The command line {@link Options}
47-
* @param arguments The command line arguments to be parsed
46+
* @param options The command line {@link Options}.
47+
* @param arguments The command line arguments to be parsed.
4848
* @param stopAtNonOption Specifies whether to stop flattening when an non option is found.
4949
* @return The {@code arguments} String array.
5050
*/
5151
@Override
5252
protected String[] flatten(@SuppressWarnings("unused") final Options options, final String[] arguments,
53-
@SuppressWarnings("unused") final boolean stopAtNonOption) {
53+
@SuppressWarnings("unused") final boolean stopAtNonOption) {
5454
// just echo the arguments
5555
return arguments;
5656
}

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

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ public interface CommandLineParser {
2626
/**
2727
* Parses the arguments according to the specified options.
2828
*
29-
* @param options the specified Options
30-
* @param arguments the command line arguments
31-
* @return the list of atomic option and value tokens
29+
* @param options the specified Options.
30+
* @param arguments the command line arguments.
31+
* @return the list of atomic option and value tokens.
3232
* @throws ParseException if there are any problems encountered while parsing the command line tokens.
3333
*/
3434
CommandLine parse(Options options, String[] arguments) throws ParseException;
3535

3636
/**
3737
* Parses the arguments according to the specified options and properties.
3838
*
39-
* @param options the specified Options
40-
* @param arguments the command line arguments
41-
* @param properties command line option name-value pairs
42-
* @return the list of atomic option and value tokens
39+
* @param options the specified Options.
40+
* @param arguments the command line arguments.
41+
* @param properties command line option name-value pairs.
42+
* @return the list of atomic option and value tokens.
4343
* @throws ParseException if there are any problems encountered while parsing the command line tokens.
4444
*/
4545
/*
@@ -51,33 +51,28 @@ public interface CommandLineParser {
5151
/**
5252
* Parses the arguments according to the specified options.
5353
*
54-
* @param options the specified Options
55-
* @param arguments the command line arguments
54+
* @param options the specified Options.
55+
* @param arguments the command line arguments.
5656
* @param stopAtNonOption if {@code true} an unrecognized argument stops the parsing and the remaining arguments
5757
* are added to the {@link CommandLine}s args list. If {@code false} an unrecognized argument triggers a
5858
* ParseException.
5959
*
60-
* @return the list of atomic option and value tokens
60+
* @return the list of atomic option and value tokens.
6161
* @throws ParseException if there are any problems encountered while parsing the command line tokens.
6262
*/
6363
CommandLine parse(Options options, String[] arguments, boolean stopAtNonOption) throws ParseException;
6464

6565
/**
6666
* Parses the arguments according to the specified options and properties.
6767
*
68-
* @param options the specified Options
69-
* @param arguments the command line arguments
70-
* @param properties command line option name-value pairs
68+
* @param options the specified Options.
69+
* @param arguments the command line arguments.
70+
* @param properties command line option name-value pairs.
7171
* @param stopAtNonOption if {@code true} an unrecognized argument stops the parsing and the remaining arguments
7272
* are added to the {@link CommandLine}s args list. If {@code false} an unrecognized argument triggers a
7373
* ParseException.
7474
*
75-
* @return the list of atomic option and value tokens
75+
* @return the list of atomic option and value tokens.
7676
* @throws ParseException if there are any problems encountered while parsing the command line tokens.
7777
*/
78-
/*
79-
* To maintain binary compatibility, this is commented out. It is still in the abstract Parser class, so most users will
80-
* still reap the benefit. CommandLine parse(Options options, String[] arguments, Properties properties, boolean
81-
* stopAtNonOption) throws ParseException;
82-
*/
8378
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public interface Converter<T, E extends Exception> {
8181
/**
8282
* Applies the conversion function to the String argument.
8383
*
84-
* @param string the String to convert
84+
* @param string the String to convert.
8585
* @return the Object from the conversion.
8686
* @throws E on error.
8787
*/

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

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ public static final class Builder implements Supplier<DefaultParser> {
6464

6565
/**
6666
* Constructs a new {@code Builder} for a {@code DefaultParser} instance.
67-
*
68-
* Both allowPartialMatching and stripLeadingAndTrailingQuotes are true by default,
69-
* mimicking the argument-less constructor.
67+
* <p>
68+
* Both allowPartialMatching and stripLeadingAndTrailingQuotes are true by default, mimicking the argument-less constructor.
69+
* </p>
7070
*/
7171
private Builder() {
7272
}
@@ -96,10 +96,12 @@ public DefaultParser get() {
9696

9797
/**
9898
* Sets if partial matching of long options is supported.
99-
*
99+
* <p>
100100
* By "partial matching" we mean that given the following code:
101+
* </p>
101102
*
102103
* <pre>
104+
*
103105
* {
104106
* &#64;code
105107
* final Options options = new Options();
@@ -108,12 +110,13 @@ public DefaultParser get() {
108110
* options.addOption(new Option("o", "option", true, "Turn on option with argument."));
109111
* }
110112
* </pre>
111-
*
112-
* If "partial matching" is turned on, {@code -de} only matches the {@code "debug"} option. However, with
113-
* "partial matching" disabled, {@code -de} would enable both {@code debug} as well as {@code extract}
113+
* <p>
114+
* If "partial matching" is turned on, {@code -de} only matches the {@code "debug"} option. However, with "partial matching" disabled, {@code -de} would
115+
* enable both {@code debug} as well as {@code extract}
116+
* </p>
114117
*
115118
* @param allowPartialMatching whether to allow partial matching of long options.
116-
* @return {@code this} instance..
119+
* @return {@code this} instance.
117120
* @since 1.5.0
118121
*/
119122
public Builder setAllowPartialMatching(final boolean allowPartialMatching) {
@@ -136,13 +139,14 @@ public Builder setDeprecatedHandler(final Consumer<Option> deprecatedHandler) {
136139
/**
137140
* Sets if balanced leading and trailing double quotes should be stripped from option arguments.
138141
*
139-
* If "stripping of balanced leading and trailing double quotes from option arguments" is true,
140-
* the outermost balanced double quotes of option arguments values will be removed.
141-
* For example, {@code -o '"x"'} getValue() will return {@code x}, instead of {@code "x"}
142-
*
143-
* If "stripping of balanced leading and trailing double quotes from option arguments" is null,
144-
* then quotes will be stripped from option values separated by space from the option, but
145-
* kept in other cases, which is the historic behavior.
142+
* <p>
143+
* If "stripping of balanced leading and trailing double quotes from option arguments" is true, the outermost balanced double quotes of option arguments
144+
* values will be removed. For example, {@code -o '"x"'} getValue() will return {@code x}, instead of {@code "x"}
145+
* </p>
146+
* <p>
147+
* If "stripping of balanced leading and trailing double quotes from option arguments" is null, then quotes will be stripped from option values
148+
* separated by space from the option, but kept in other cases, which is the historic behavior.
149+
* </p>
146150
*
147151
* @param stripLeadingAndTrailingQuotes whether balanced leading and trailing double quotes should be stripped from option arguments.
148152
* @return {@code this} instance.
@@ -248,8 +252,9 @@ static int indexOfEqual(final String token) {
248252

249253
/**
250254
* Creates a new DefaultParser instance with partial matching enabled.
251-
*
255+
* <p>
252256
* By "partial matching" we mean that given the following code:
257+
* </p>
253258
*
254259
* <pre>
255260
* {
@@ -273,9 +278,9 @@ public DefaultParser() {
273278

274279
/**
275280
* Create a new DefaultParser instance with the specified partial matching policy.
276-
*
281+
* <p>
277282
* By "partial matching" we mean that given the following code:
278-
*
283+
* </p>
279284
* <pre>
280285
* {
281286
* &#64;code
@@ -285,10 +290,11 @@ public DefaultParser() {
285290
* options.addOption(new Option("o", "option", true, "Turn on option with argument."));
286291
* }
287292
* </pre>
288-
*
293+
* <p>
289294
* with "partial matching" turned on, {@code -de} only matches the {@code "debug"} option. However, with
290295
* "partial matching" disabled, {@code -de} would enable both {@code debug} as well as {@code extract}
291296
* options.
297+
* </p>
292298
*
293299
* @param allowPartialMatching if partial matching of long options shall be enabled
294300
*/

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
2424
* The class GnuParser provides an implementation of the {@link Parser#flatten(Options, String[], boolean) flatten}
2525
* method.
2626
*
27-
* @deprecated since 1.3, use the {@link DefaultParser} instead
27+
* @deprecated since 1.3, use the {@link DefaultParser} instead.
2828
*/
2929
@Deprecated
3030
public class GnuParser extends Parser {
@@ -47,8 +47,8 @@ public GnuParser() {
4747
*
4848
* @param options The Options to parse the arguments by.
4949
* @param arguments The arguments that have to be flattened.
50-
* @param stopAtNonOption specifies whether to stop flattening when a non option has been encountered
51-
* @return a String array of the flattened arguments
50+
* @param stopAtNonOption specifies whether to stop flattening when a non option has been encountered.
51+
* @return a String array of the flattened arguments.
5252
*/
5353
@Override
5454
protected String[] flatten(final Options options, final String[] arguments, final boolean stopAtNonOption) {
@@ -84,15 +84,13 @@ protected String[] flatten(final Options options, final String[] arguments, fina
8484
} else {
8585
tokens.add(arg);
8686
}
87-
8887
if (eatTheRest) {
8988
for (i++; i < arguments.length; i++) { // NOPMD
9089
tokens.add(arguments[i]);
9190
}
9291
}
9392
}
9493
}
95-
9694
return tokens.toArray(Util.EMPTY_STRING_ARRAY);
9795
}
9896
}

0 commit comments

Comments
 (0)