Skip to content

Commit 80f2d7b

Browse files
committed
Sort members
1 parent b1f015e commit 80f2d7b

File tree

6 files changed

+119
-119
lines changed

6 files changed

+119
-119
lines changed

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

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -153,21 +153,6 @@ public Builder setStripLeadingAndTrailingQuotes(final Boolean stripLeadingAndTra
153153
}
154154
}
155155

156-
/**
157-
* Creates a new {@link Builder} to create an {@link DefaultParser} using descriptive
158-
* methods.
159-
*
160-
* @return a new {@link Builder} instance
161-
* @since 1.5.0
162-
*/
163-
public static Builder builder() {
164-
return new Builder();
165-
}
166-
167-
static int indexOfEqual(final String token) {
168-
return token.indexOf(Char.EQUAL);
169-
}
170-
171156
/**
172157
* Enum representing possible actions that may be done when "non option" is discovered during parsing.
173158
*
@@ -194,6 +179,21 @@ public enum NonOptionAction {
194179
THROW;
195180
}
196181

182+
/**
183+
* Creates a new {@link Builder} to create an {@link DefaultParser} using descriptive
184+
* methods.
185+
*
186+
* @return a new {@link Builder} instance
187+
* @since 1.5.0
188+
*/
189+
public static Builder builder() {
190+
return new Builder();
191+
}
192+
193+
static int indexOfEqual(final String token) {
194+
return token.indexOf(Char.EQUAL);
195+
}
196+
197197
/** The command-line instance. */
198198
protected CommandLine cmd;
199199

@@ -308,6 +308,16 @@ private DefaultParser(final boolean allowPartialMatching, final Boolean stripLea
308308
this.deprecatedHandler = deprecatedHandler;
309309
}
310310

311+
/**
312+
* Adds token to command line {@link CommandLine#addArg(String)}.
313+
*
314+
* @param token the unrecognized option/argument.
315+
* @since 1.10.0
316+
*/
317+
protected void addArg(final String token) {
318+
cmd.addArg(token);
319+
}
320+
311321
/**
312322
* Throws a {@link MissingArgumentException} if the current option didn't receive the number of arguments expected.
313323
*/
@@ -633,16 +643,6 @@ protected void handleUnknownToken(final String token) throws ParseException {
633643
}
634644
}
635645

636-
/**
637-
* Adds token to command line {@link CommandLine#addArg(String)}.
638-
*
639-
* @param token the unrecognized option/argument.
640-
* @since 1.10.0
641-
*/
642-
protected void addArg(final String token) {
643-
cmd.addArg(token);
644-
}
645-
646646
/**
647647
* Tests if the token is a valid argument.
648648
*
@@ -726,6 +726,43 @@ private boolean isShortOption(final String token) {
726726
return !optName.isEmpty() && options.hasShortOption(String.valueOf(optName.charAt(0)));
727727
}
728728

729+
/**
730+
* Parses the arguments according to the specified options and properties.
731+
*
732+
* @param options the specified Options
733+
* @param properties command line option name-value pairs
734+
* @param nonOptionAction see {@link NonOptionAction}.
735+
* @param arguments the command line arguments
736+
*
737+
* @return the list of atomic option and value tokens
738+
* @throws ParseException if there are any problems encountered while parsing the command line tokens.
739+
* @since 1.10.0
740+
*/
741+
public CommandLine parse(final Options options, final Properties properties, final NonOptionAction nonOptionAction, final String... arguments)
742+
throws ParseException {
743+
this.options = options;
744+
this.nonOptionAction = nonOptionAction;
745+
skipParsing = false;
746+
currentOption = null;
747+
expectedOpts = new ArrayList<>(options.getRequiredOptions());
748+
// clear the data from the groups
749+
for (final OptionGroup group : options.getOptionGroups()) {
750+
group.setSelected(null);
751+
}
752+
cmd = CommandLine.builder().setDeprecatedHandler(deprecatedHandler).get();
753+
if (arguments != null) {
754+
for (final String argument : arguments) {
755+
handleToken(argument);
756+
}
757+
}
758+
// check the arguments of the last option
759+
checkRequiredArgs();
760+
// add the default options
761+
handleProperties(properties);
762+
checkRequiredOptions();
763+
return cmd;
764+
}
765+
729766
@Override
730767
public CommandLine parse(final Options options, final String[] arguments) throws ParseException {
731768
return parse(options, arguments, null);
@@ -771,43 +808,6 @@ public CommandLine parse(final Options options, final String[] arguments, final
771808
return parse(options, properties, stopAtNonOption ? NonOptionAction.STOP : NonOptionAction.THROW, arguments);
772809
}
773810

774-
/**
775-
* Parses the arguments according to the specified options and properties.
776-
*
777-
* @param options the specified Options
778-
* @param properties command line option name-value pairs
779-
* @param nonOptionAction see {@link NonOptionAction}.
780-
* @param arguments the command line arguments
781-
*
782-
* @return the list of atomic option and value tokens
783-
* @throws ParseException if there are any problems encountered while parsing the command line tokens.
784-
* @since 1.10.0
785-
*/
786-
public CommandLine parse(final Options options, final Properties properties, final NonOptionAction nonOptionAction, final String... arguments)
787-
throws ParseException {
788-
this.options = options;
789-
this.nonOptionAction = nonOptionAction;
790-
skipParsing = false;
791-
currentOption = null;
792-
expectedOpts = new ArrayList<>(options.getRequiredOptions());
793-
// clear the data from the groups
794-
for (final OptionGroup group : options.getOptionGroups()) {
795-
group.setSelected(null);
796-
}
797-
cmd = CommandLine.builder().setDeprecatedHandler(deprecatedHandler).get();
798-
if (arguments != null) {
799-
for (final String argument : arguments) {
800-
handleToken(argument);
801-
}
802-
}
803-
// check the arguments of the last option
804-
checkRequiredArgs();
805-
// add the default options
806-
handleProperties(properties);
807-
checkRequiredOptions();
808-
return cmd;
809-
}
810-
811811
/**
812812
* Strips balanced leading and trailing quotes if the stripLeadingAndTrailingQuotes is set
813813
* If stripLeadingAndTrailingQuotes is null, then do not strip

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,6 @@ public static class Builder implements Supplier<HelpFormatter> {
7878
// TODO All other instance HelpFormatter instance variables.
7979
// Make HelpFormatter immutable for 2.0
8080

81-
/**
82-
* Constructs a new instance.
83-
*/
84-
public Builder() {
85-
// empty
86-
}
87-
8881
/**
8982
* A function to convert a description (not null) and a deprecated Option (not null) to help description
9083
*/
@@ -103,6 +96,13 @@ public Builder() {
10396
/** The flag to determine if the since values should be dispalyed */
10497
private boolean showSince;
10598

99+
/**
100+
* Constructs a new instance.
101+
*/
102+
public Builder() {
103+
// empty
104+
}
105+
106106
@Override
107107
public HelpFormatter get() {
108108
return new HelpFormatter(deprecatedFormatFunction, printStream, showSince);

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ Licensed to the Apache Software Foundation (ASF) under one or more
2828
*/
2929
public class OptionGroup implements Serializable {
3030

31-
/**
32-
* Constructs a new instance.
33-
*/
34-
public OptionGroup() {
35-
// empty
36-
}
37-
3831
/** The serial version UID. */
3932
private static final long serialVersionUID = 1L;
4033

@@ -47,6 +40,13 @@ public OptionGroup() {
4740
/** Specified whether this group is required */
4841
private boolean required;
4942

43+
/**
44+
* Constructs a new instance.
45+
*/
46+
public OptionGroup() {
47+
// empty
48+
}
49+
5050
/**
5151
* Adds the given {@code Option} to this group.
5252
*

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ Licensed to the Apache Software Foundation (ASF) under one or more
4040
*/
4141
public class Options implements Serializable {
4242

43-
/**
44-
* Constructs new instance.
45-
*/
46-
public Options() {
47-
// empty
48-
}
49-
5043
/** The serial version UID. */
5144
private static final long serialVersionUID = 1L;
5245

@@ -64,6 +57,13 @@ public Options() {
6457
/** A map of the option groups */
6558
private final Map<String, OptionGroup> optionGroups = new LinkedHashMap<>();
6659

60+
/**
61+
* Constructs new instance.
62+
*/
63+
public Options() {
64+
// empty
65+
}
66+
6767
/**
6868
* Adds an option instance
6969
*

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,6 @@ Licensed to the Apache Software Foundation (ASF) under one or more
7474
*/
7575
public class PatternOptionBuilder {
7676

77-
/**
78-
* Deprecated, only provides static methods.
79-
*
80-
* @deprecated Will be private or class will be final.
81-
*/
82-
@Deprecated
83-
public PatternOptionBuilder() {
84-
// empty
85-
}
86-
8777
/** String class */
8878
public static final Class<String> STRING_VALUE = String.class;
8979

@@ -99,13 +89,13 @@ public PatternOptionBuilder() {
9989
/** Class class */
10090
public static final Class<?> CLASS_VALUE = Class.class;
10191

92+
/** FileInputStream class */
93+
public static final Class<FileInputStream> EXISTING_FILE_VALUE = FileInputStream.class;
94+
10295
/// can we do this one??
10396
// is meant to check that the file exists, else it errors.
10497
// ie) it's for reading not writing.
10598

106-
/** FileInputStream class */
107-
public static final Class<FileInputStream> EXISTING_FILE_VALUE = FileInputStream.class;
108-
10999
/** File class */
110100
public static final Class<File> FILE_VALUE = File.class;
111101

@@ -236,4 +226,14 @@ public static Options parsePattern(final String pattern) {
236226
static <T> T unsupported() {
237227
return (T) UNSUPPORTED;
238228
}
229+
230+
/**
231+
* Deprecated, only provides static methods.
232+
*
233+
* @deprecated Will be private or class will be final.
234+
*/
235+
@Deprecated
236+
public PatternOptionBuilder() {
237+
// empty
238+
}
239239
}

0 commit comments

Comments
 (0)