Skip to content

Commit cfd100d

Browse files
committed
Better internal names.
1 parent 4723175 commit cfd100d

1 file changed

Lines changed: 19 additions & 18 deletions

File tree

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

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,15 @@ public class Option implements Cloneable, Serializable {
4848
* @since 1.3
4949
*/
5050
public static final class Builder {
51+
5152
/** the name of the option */
52-
private final String opt;
53+
private final String option;
5354

5455
/** description of the option */
5556
private String description;
5657

5758
/** the long representation of the option */
58-
private String longOpt;
59+
private String longOption;
5960

6061
/** the name of the argument for this option */
6162
private String argName;
@@ -67,23 +68,23 @@ public static final class Builder {
6768
private boolean optionalArg;
6869

6970
/** the number of argument values this option can have */
70-
private int numberOfArgs = UNINITIALIZED;
71+
private int argCount = UNINITIALIZED;
7172

7273
/** the type of this Option */
7374
private Class<?> type = String.class;
7475

7576
/** the character that is the value separator */
76-
private char valuesep;
77+
private char valueSeparator;
7778

7879
/**
7980
* Constructs a new {@code Builder} with the minimum required parameters for an {@code Option} instance.
8081
*
81-
* @param opt short representation of the option
82+
* @param option short representation of the option
8283
* @throws IllegalArgumentException if there are any non valid Option characters in {@code opt}
8384
*/
84-
private Builder(final String opt) throws IllegalArgumentException {
85-
OptionValidator.validateOption(opt);
86-
this.opt = opt;
85+
private Builder(final String option) throws IllegalArgumentException {
86+
OptionValidator.validateOption(option);
87+
this.option = option;
8788
}
8889

8990
/**
@@ -104,7 +105,7 @@ public Builder argName(final String argName) {
104105
* @throws IllegalArgumentException if neither {@code opt} or {@code longOpt} has been set
105106
*/
106107
public Option build() {
107-
if (opt == null && longOpt == null) {
108+
if (option == null && longOption == null) {
108109
throw new IllegalArgumentException("Either opt or longOpt must be specified");
109110
}
110111
return new Option(this);
@@ -138,7 +139,7 @@ public Builder hasArg() {
138139
*/
139140
public Builder hasArg(final boolean hasArg) {
140141
// set to UNINITIALIZED when no arg is specified to be compatible with OptionBuilder
141-
numberOfArgs = hasArg ? 1 : Option.UNINITIALIZED;
142+
argCount = hasArg ? 1 : Option.UNINITIALIZED;
142143
return this;
143144
}
144145

@@ -148,7 +149,7 @@ public Builder hasArg(final boolean hasArg) {
148149
* @return this builder, to allow method chaining
149150
*/
150151
public Builder hasArgs() {
151-
numberOfArgs = Option.UNLIMITED_VALUES;
152+
argCount = Option.UNLIMITED_VALUES;
152153
return this;
153154
}
154155

@@ -159,7 +160,7 @@ public Builder hasArgs() {
159160
* @return this builder, to allow method chaining
160161
*/
161162
public Builder longOpt(final String longOpt) {
162-
this.longOpt = longOpt;
163+
this.longOption = longOpt;
163164
return this;
164165
}
165166

@@ -170,7 +171,7 @@ public Builder longOpt(final String longOpt) {
170171
* @return this builder, to allow method chaining
171172
*/
172173
public Builder numberOfArgs(final int numberOfArgs) {
173-
this.numberOfArgs = numberOfArgs;
174+
this.argCount = numberOfArgs;
174175
return this;
175176
}
176177

@@ -245,7 +246,7 @@ public Builder valueSeparator() {
245246
* @return this builder, to allow method chaining
246247
*/
247248
public Builder valueSeparator(final char sep) {
248-
valuesep = sep;
249+
valueSeparator = sep;
249250
return this;
250251
}
251252
}
@@ -319,13 +320,13 @@ public static Builder builder(final String opt) {
319320
private Option(final Builder builder) {
320321
this.argName = builder.argName;
321322
this.description = builder.description;
322-
this.longOpt = builder.longOpt;
323-
this.numberOfArgs = builder.numberOfArgs;
324-
this.opt = builder.opt;
323+
this.longOpt = builder.longOption;
324+
this.numberOfArgs = builder.argCount;
325+
this.opt = builder.option;
325326
this.optionalArg = builder.optionalArg;
326327
this.required = builder.required;
327328
this.type = builder.type;
328-
this.valuesep = builder.valuesep;
329+
this.valuesep = builder.valueSeparator;
329330
}
330331

331332
/**

0 commit comments

Comments
 (0)