@@ -31,7 +31,6 @@ Licensed to the Apache Software Foundation (ASF) under one or more
3131@ Deprecated
3232public final class OptionBuilder {
3333
34-
3534 /** Long option */
3635 private static String longOption ;
3736
@@ -72,7 +71,7 @@ public final class OptionBuilder {
7271 */
7372 public static Option create () throws IllegalArgumentException {
7473 if (longOption == null ) {
75- OptionBuilder . reset ();
74+ reset ();
7675 throw new IllegalArgumentException ("must specify longopt" );
7776 }
7877
@@ -114,7 +113,7 @@ public static Option create(final String opt) throws IllegalArgumentException {
114113 option .setArgName (argName );
115114 } finally {
116115 // reset the OptionBuilder properties
117- OptionBuilder . reset ();
116+ reset ();
118117 }
119118
120119 // return the Option instance
@@ -127,8 +126,7 @@ public static Option create(final String opt) throws IllegalArgumentException {
127126 * @return the OptionBuilder instance
128127 */
129128 public static OptionBuilder hasArg () {
130- OptionBuilder .argCount = 1 ;
131-
129+ argCount = 1 ;
132130 return INSTANCE ;
133131 }
134132
@@ -139,8 +137,7 @@ public static OptionBuilder hasArg() {
139137 * @return the OptionBuilder instance
140138 */
141139 public static OptionBuilder hasArg (final boolean hasArg ) {
142- OptionBuilder .argCount = hasArg ? 1 : Option .UNINITIALIZED ;
143-
140+ argCount = hasArg ? 1 : Option .UNINITIALIZED ;
144141 return INSTANCE ;
145142 }
146143
@@ -150,8 +147,7 @@ public static OptionBuilder hasArg(final boolean hasArg) {
150147 * @return the OptionBuilder instance
151148 */
152149 public static OptionBuilder hasArgs () {
153- OptionBuilder .argCount = Option .UNLIMITED_VALUES ;
154-
150+ argCount = Option .UNLIMITED_VALUES ;
155151 return INSTANCE ;
156152 }
157153
@@ -162,8 +158,7 @@ public static OptionBuilder hasArgs() {
162158 * @return the OptionBuilder instance
163159 */
164160 public static OptionBuilder hasArgs (final int num ) {
165- OptionBuilder .argCount = num ;
166-
161+ argCount = num ;
167162 return INSTANCE ;
168163 }
169164
@@ -173,9 +168,8 @@ public static OptionBuilder hasArgs(final int num) {
173168 * @return the OptionBuilder instance
174169 */
175170 public static OptionBuilder hasOptionalArg () {
176- OptionBuilder .argCount = 1 ;
177- OptionBuilder .optionalArg = true ;
178-
171+ argCount = 1 ;
172+ optionalArg = true ;
179173 return INSTANCE ;
180174 }
181175
@@ -185,9 +179,8 @@ public static OptionBuilder hasOptionalArg() {
185179 * @return the OptionBuilder instance
186180 */
187181 public static OptionBuilder hasOptionalArgs () {
188- OptionBuilder .argCount = Option .UNLIMITED_VALUES ;
189- OptionBuilder .optionalArg = true ;
190-
182+ argCount = Option .UNLIMITED_VALUES ;
183+ optionalArg = true ;
191184 return INSTANCE ;
192185 }
193186
@@ -198,9 +191,8 @@ public static OptionBuilder hasOptionalArgs() {
198191 * @return the OptionBuilder instance
199192 */
200193 public static OptionBuilder hasOptionalArgs (final int numArgs ) {
201- OptionBuilder .argCount = numArgs ;
202- OptionBuilder .optionalArg = true ;
203-
194+ argCount = numArgs ;
195+ optionalArg = true ;
204196 return INSTANCE ;
205197 }
206198
@@ -210,8 +202,7 @@ public static OptionBuilder hasOptionalArgs(final int numArgs) {
210202 * @return the OptionBuilder instance
211203 */
212204 public static OptionBuilder isRequired () {
213- OptionBuilder .required = true ;
214-
205+ required = true ;
215206 return INSTANCE ;
216207 }
217208
@@ -222,8 +213,7 @@ public static OptionBuilder isRequired() {
222213 * @return the OptionBuilder instance
223214 */
224215 public static OptionBuilder isRequired (final boolean newRequired ) {
225- OptionBuilder .required = newRequired ;
226-
216+ required = newRequired ;
227217 return INSTANCE ;
228218 }
229219
@@ -248,8 +238,7 @@ private static void reset() {
248238 * @return the OptionBuilder instance
249239 */
250240 public static OptionBuilder withArgName (final String name ) {
251- OptionBuilder .argName = name ;
252-
241+ argName = name ;
253242 return INSTANCE ;
254243 }
255244
@@ -260,8 +249,7 @@ public static OptionBuilder withArgName(final String name) {
260249 * @return the OptionBuilder instance
261250 */
262251 public static OptionBuilder withDescription (final String newDescription ) {
263- OptionBuilder .description = newDescription ;
264-
252+ description = newDescription ;
265253 return INSTANCE ;
266254 }
267255
@@ -272,8 +260,7 @@ public static OptionBuilder withDescription(final String newDescription) {
272260 * @return the OptionBuilder instance
273261 */
274262 public static OptionBuilder withLongOpt (final String newLongopt ) {
275- OptionBuilder .longOption = newLongopt ;
276-
263+ longOption = newLongopt ;
277264 return INSTANCE ;
278265 }
279266
@@ -285,8 +272,7 @@ public static OptionBuilder withLongOpt(final String newLongopt) {
285272 * @since 1.3
286273 */
287274 public static OptionBuilder withType (final Class <?> newType ) {
288- OptionBuilder .type = newType ;
289-
275+ type = newType ;
290276 return INSTANCE ;
291277 }
292278
@@ -311,7 +297,7 @@ public static OptionBuilder withType(final Object newType) {
311297 * <b>Example:</b>
312298 *
313299 * <pre>
314- * Option opt = OptionBuilder. withValueSeparator().create('D');
300+ * Option opt = withValueSeparator().create('D');
315301 *
316302 * CommandLine line = parser.parse(args);
317303 * String propertyName = opt.getValue(0);
@@ -321,8 +307,7 @@ public static OptionBuilder withType(final Object newType) {
321307 * @return the OptionBuilder instance
322308 */
323309 public static OptionBuilder withValueSeparator () {
324- OptionBuilder .valueSeparator = Char .EQUAL ;
325-
310+ valueSeparator = Char .EQUAL ;
326311 return INSTANCE ;
327312 }
328313
@@ -345,8 +330,7 @@ public static OptionBuilder withValueSeparator() {
345330 * @return the OptionBuilder instance
346331 */
347332 public static OptionBuilder withValueSeparator (final char sep ) {
348- OptionBuilder .valueSeparator = sep ;
349-
333+ valueSeparator = sep ;
350334 return INSTANCE ;
351335 }
352336
0 commit comments