Skip to content

Commit 8dcf119

Browse files
committed
Deduplicate; better param name; close HTML tags in Javadoc.
1 parent b42fb92 commit 8dcf119

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,22 @@ Licensed to the Apache Software Foundation (ASF) under one or more
2929
* <p>
3030
* An Option is not created independently, but is created through an instance of {@link Options}. An Option is required
3131
* to have at least a short or a long-name.
32+
* </p>
3233
* <p>
3334
* <b>Note:</b> once an {@link Option} has been added to an instance of {@link Options}, its required flag cannot be
3435
* changed.
36+
* </p>
3537
*
3638
* @see org.apache.commons.cli.Options
3739
* @see org.apache.commons.cli.CommandLine
3840
*/
3941
public class Option implements Cloneable, Serializable {
42+
4043
/**
4144
* A nested builder class to create {@code Option} instances using descriptive methods.
4245
* <p>
4346
* Example usage:
47+
* </p>
4448
*
4549
* <pre>
4650
* Option option = Option.builder("a").required(true).longOpt("arg-name").build();
@@ -84,7 +88,7 @@ public static final class Builder {
8488
* @throws IllegalArgumentException if there are any non valid Option characters in {@code opt}
8589
*/
8690
private Builder(final String option) throws IllegalArgumentException {
87-
this.option = OptionValidator.validate(option);
91+
option(option);
8892
}
8993

9094
/**
@@ -243,6 +247,7 @@ public Builder valueSeparator() {
243247
* The Option will use {@code sep} as a means to separate argument values.
244248
* <p>
245249
* <b>Example:</b>
250+
* </p>
246251
*
247252
* <pre>
248253
* Option opt = Option.builder("D").hasArgs().valueSeparator('=').build();
@@ -286,13 +291,13 @@ public static Builder builder() {
286291
/**
287292
* Returns a {@link Builder} to create an {@link Option} using descriptive methods.
288293
*
289-
* @param opt short representation of the option
294+
* @param option short representation of the option
290295
* @return a new {@link Builder} instance
291296
* @throws IllegalArgumentException if there are any non valid Option characters in {@code opt}
292297
* @since 1.3
293298
*/
294-
public static Builder builder(final String opt) {
295-
return new Builder(opt);
299+
public static Builder builder(final String option) {
300+
return new Builder(option);
296301
}
297302

298303
/** The name of the option. */
@@ -835,6 +840,7 @@ public void setType(final Class<?> type) {
835840
* <p>
836841
* <b>Note:</b> this method is kept for binary compatibility and the input type is supposed to be a {@link Class}
837842
* object.
843+
* </p>
838844
*
839845
* @param type the type of this Option
840846
* @deprecated since 1.3, use {@link #setType(Class)} instead

0 commit comments

Comments
 (0)