Skip to content

Commit c851091

Browse files
author
Niall Kegan Pemberton
committed
Remove tab characters
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/trunk@639981 13f79535-47bb-0310-9956-ffa450edef68
1 parent 6e11746 commit c851091

8 files changed

Lines changed: 247 additions & 247 deletions

File tree

src/java/org/apache/commons/cli2/Option.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,13 @@ void appendUsage(
181181
*/
182182
int getId();
183183

184-
/**
185-
* Recursively searches for an option with the supplied trigger.
186-
*
187-
* @param trigger the trigger to search for.
188-
* @return the matching option or null.
189-
*/
190-
Option findOption(final String trigger);
184+
/**
185+
* Recursively searches for an option with the supplied trigger.
186+
*
187+
* @param trigger the trigger to search for.
188+
* @return the matching option or null.
189+
*/
190+
Option findOption(final String trigger);
191191

192192
/**
193193
* Indicates whether this option is required to be present.

src/java/org/apache/commons/cli2/builder/ArgumentBuilder.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
*/
3131
public class ArgumentBuilder {
3232

33-
/** i18n */
34-
private final static ResourceHelper resources = ResourceHelper.getResourceHelper();
33+
/** i18n */
34+
private final static ResourceHelper resources = ResourceHelper.getResourceHelper();
3535

3636
/** name of the argument. Used for display and lookups in CommandLine */
3737
private String name;
@@ -124,12 +124,12 @@ public final ArgumentBuilder reset() {
124124
* @return this ArgumentBuilder
125125
*/
126126
public final ArgumentBuilder withName(final String newName) {
127-
if (newName == null) {
128-
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_NAME));
129-
}
130-
if ("".equals(newName)) {
131-
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_EMPTY_NAME));
132-
}
127+
if (newName == null) {
128+
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_NAME));
129+
}
130+
if ("".equals(newName)) {
131+
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_EMPTY_NAME));
132+
}
133133
this.name = newName;
134134
return this;
135135
}
@@ -154,9 +154,9 @@ public final ArgumentBuilder withDescription(final String newDescription) {
154154
* @return this ArgumentBuilder
155155
*/
156156
public final ArgumentBuilder withMinimum(final int newMinimum) {
157-
if (newMinimum < 0) {
158-
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NEGATIVE_MINIMUM));
159-
}
157+
if (newMinimum < 0) {
158+
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NEGATIVE_MINIMUM));
159+
}
160160
this.minimum = newMinimum;
161161
return this;
162162
}
@@ -168,9 +168,9 @@ public final ArgumentBuilder withMinimum(final int newMinimum) {
168168
* @return this ArgumentBuilder
169169
*/
170170
public final ArgumentBuilder withMaximum(final int newMaximum) {
171-
if (newMaximum < 0) {
172-
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NEGATIVE_MAXIMUM));
173-
}
171+
if (newMaximum < 0) {
172+
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NEGATIVE_MAXIMUM));
173+
}
174174
this.maximum = newMaximum;
175175
return this;
176176
}
@@ -215,9 +215,9 @@ public final ArgumentBuilder withSubsequentSeparator(
215215
* @return this ArgumentBuilder
216216
*/
217217
public final ArgumentBuilder withValidator(final Validator newValidator) {
218-
if (newValidator == null) {
219-
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_VALIDATOR));
220-
}
218+
if (newValidator == null) {
219+
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_VALIDATOR));
220+
}
221221
this.validator = newValidator;
222222
return this;
223223
}
@@ -231,12 +231,12 @@ public final ArgumentBuilder withValidator(final Validator newValidator) {
231231
* @return this ArgumentBuilder
232232
*/
233233
public final ArgumentBuilder withConsumeRemaining(final String newConsumeRemaining) {
234-
if (newConsumeRemaining == null) {
235-
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_CONSUME_REMAINING));
236-
}
237-
if ( "".equals(newConsumeRemaining)) {
238-
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_EMPTY_CONSUME_REMAINING));
239-
}
234+
if (newConsumeRemaining == null) {
235+
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_CONSUME_REMAINING));
236+
}
237+
if ( "".equals(newConsumeRemaining)) {
238+
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_EMPTY_CONSUME_REMAINING));
239+
}
240240
this.consumeRemaining = newConsumeRemaining;
241241
return this;
242242
}
@@ -248,9 +248,9 @@ public final ArgumentBuilder withConsumeRemaining(final String newConsumeRemaini
248248
* @return this ArgumentBuilder
249249
*/
250250
public final ArgumentBuilder withDefault(final Object defaultValue) {
251-
if (defaultValue == null) {
252-
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_DEFAULT));
253-
}
251+
if (defaultValue == null) {
252+
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_DEFAULT));
253+
}
254254

255255
if (this.defaultValues == null) {
256256
this.defaultValues = new ArrayList(1);
@@ -266,9 +266,9 @@ public final ArgumentBuilder withDefault(final Object defaultValue) {
266266
* @return this ArgumentBuilder
267267
*/
268268
public final ArgumentBuilder withDefaults(final List newDefaultValues) {
269-
if (newDefaultValues == null) {
270-
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_DEFAULTS));
271-
}
269+
if (newDefaultValues == null) {
270+
throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_DEFAULTS));
271+
}
272272
this.defaultValues = newDefaultValues;
273273
return this;
274274
}

src/java/org/apache/commons/cli2/commandline/DefaultingCommandLine.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void insertCommandLine(
7474
* @return an unmodifiable iterator
7575
*/
7676
public Iterator commandLines(){
77-
return Collections.unmodifiableList(commandLines).iterator();
77+
return Collections.unmodifiableList(commandLines).iterator();
7878
}
7979

8080
public Option getOption(String trigger) {
@@ -132,10 +132,10 @@ public List getValues(Option option, List defaultValues) {
132132
}
133133
}
134134
if(defaultValues==null){
135-
return Collections.EMPTY_LIST;
135+
return Collections.EMPTY_LIST;
136136
}
137137
else{
138-
return defaultValues;
138+
return defaultValues;
139139
}
140140
}
141141

src/java/org/apache/commons/cli2/commandline/PreferencesCommandLine.java

Lines changed: 106 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,21 @@
4848
*/
4949
public class PreferencesCommandLine extends CommandLineImpl {
5050

51-
private static final char NUL = '\0';
52-
private final Preferences preferences;
53-
private final Option root;
54-
private final char separator;
51+
private static final char NUL = '\0';
52+
private final Preferences preferences;
53+
private final Option root;
54+
private final char separator;
5555

56-
/**
56+
/**
5757
* Creates a new PreferencesCommandLine using the specified root Option and
5858
* Preferences node. Argument values will be separated using the char 0.
5959
*
60-
* @param root the CommandLine's root Option
61-
* @param preferences the Preferences node to get values from
62-
*/
63-
public PreferencesCommandLine(final Option root, final Preferences preferences){
64-
this(root,preferences,NUL);
65-
}
60+
* @param root the CommandLine's root Option
61+
* @param preferences the Preferences node to get values from
62+
*/
63+
public PreferencesCommandLine(final Option root, final Preferences preferences){
64+
this(root,preferences,NUL);
65+
}
6666

6767
/**
6868
* Creates a new PreferencesCommandLine using the specified root Option,
@@ -72,99 +72,99 @@ public PreferencesCommandLine(final Option root, final Preferences preferences){
7272
* @param preferences the Preferences node to get values from
7373
* @param separator the character to split argument values
7474
*/
75-
public PreferencesCommandLine(final Option root, final Preferences preferences, final char separator){
76-
this.root = root;
77-
this.preferences = preferences;
78-
this.separator = separator;
79-
}
80-
81-
public boolean hasOption(Option option) {
82-
if(option==null){
83-
return false;
84-
}
85-
else{
86-
try {
87-
return Arrays.asList(preferences.keys()).contains(option.getPreferredName());
88-
} catch (BackingStoreException e) {
89-
return false;
90-
}
91-
}
92-
}
93-
94-
public Option getOption(String trigger) {
95-
return root.findOption(trigger);
96-
}
97-
98-
public List getValues(final Option option, final List defaultValues) {
99-
final String value = preferences.get(option.getPreferredName(),null);
100-
101-
if(value==null){
102-
return defaultValues;
103-
}
104-
else if(separator>NUL){
105-
final List values = new ArrayList();
106-
final StringTokenizer tokens = new StringTokenizer(value,String.valueOf(separator));
107-
108-
while(tokens.hasMoreTokens()){
109-
values.add(tokens.nextToken());
110-
}
111-
112-
return values;
113-
}
114-
else{
115-
return Collections.singletonList(value);
116-
}
117-
}
118-
119-
public Boolean getSwitch(final Option option, final Boolean defaultValue) {
120-
final String value = preferences.get(option.getPreferredName(),null);
121-
if("true".equals(value)){
122-
return Boolean.TRUE;
123-
}
124-
else if("false".equals(value)){
125-
return Boolean.FALSE;
126-
}
127-
else{
128-
return defaultValue;
129-
}
130-
}
131-
132-
public String getProperty(final String property, final String defaultValue) {
133-
return preferences.get(property, defaultValue);
134-
}
135-
136-
public Set getProperties() {
137-
try {
138-
return new HashSet(Arrays.asList(preferences.keys()));
139-
} catch (BackingStoreException e) {
140-
return Collections.EMPTY_SET;
141-
}
142-
}
143-
144-
public List getOptions() {
145-
try {
146-
final List options = new ArrayList();
147-
final Iterator keys = Arrays.asList(preferences.keys()).iterator();
148-
while (keys.hasNext()) {
149-
final String trigger = (String) keys.next();
150-
final Option option = root.findOption(trigger);
151-
if (option != null) {
152-
options.add(option);
153-
}
154-
}
155-
return Collections.unmodifiableList(options);
156-
} catch (BackingStoreException e) {
157-
return Collections.EMPTY_LIST;
158-
}
159-
}
160-
161-
public Set getOptionTriggers() {
162-
final Set triggers = new HashSet();
163-
final Iterator options = getOptions().iterator();
164-
while(options.hasNext()){
165-
final Option option = (Option)options.next();
166-
triggers.addAll(option.getTriggers());
167-
}
168-
return Collections.unmodifiableSet(triggers);
169-
}
75+
public PreferencesCommandLine(final Option root, final Preferences preferences, final char separator){
76+
this.root = root;
77+
this.preferences = preferences;
78+
this.separator = separator;
79+
}
80+
81+
public boolean hasOption(Option option) {
82+
if(option==null){
83+
return false;
84+
}
85+
else{
86+
try {
87+
return Arrays.asList(preferences.keys()).contains(option.getPreferredName());
88+
} catch (BackingStoreException e) {
89+
return false;
90+
}
91+
}
92+
}
93+
94+
public Option getOption(String trigger) {
95+
return root.findOption(trigger);
96+
}
97+
98+
public List getValues(final Option option, final List defaultValues) {
99+
final String value = preferences.get(option.getPreferredName(),null);
100+
101+
if(value==null){
102+
return defaultValues;
103+
}
104+
else if(separator>NUL){
105+
final List values = new ArrayList();
106+
final StringTokenizer tokens = new StringTokenizer(value,String.valueOf(separator));
107+
108+
while(tokens.hasMoreTokens()){
109+
values.add(tokens.nextToken());
110+
}
111+
112+
return values;
113+
}
114+
else{
115+
return Collections.singletonList(value);
116+
}
117+
}
118+
119+
public Boolean getSwitch(final Option option, final Boolean defaultValue) {
120+
final String value = preferences.get(option.getPreferredName(),null);
121+
if("true".equals(value)){
122+
return Boolean.TRUE;
123+
}
124+
else if("false".equals(value)){
125+
return Boolean.FALSE;
126+
}
127+
else{
128+
return defaultValue;
129+
}
130+
}
131+
132+
public String getProperty(final String property, final String defaultValue) {
133+
return preferences.get(property, defaultValue);
134+
}
135+
136+
public Set getProperties() {
137+
try {
138+
return new HashSet(Arrays.asList(preferences.keys()));
139+
} catch (BackingStoreException e) {
140+
return Collections.EMPTY_SET;
141+
}
142+
}
143+
144+
public List getOptions() {
145+
try {
146+
final List options = new ArrayList();
147+
final Iterator keys = Arrays.asList(preferences.keys()).iterator();
148+
while (keys.hasNext()) {
149+
final String trigger = (String) keys.next();
150+
final Option option = root.findOption(trigger);
151+
if (option != null) {
152+
options.add(option);
153+
}
154+
}
155+
return Collections.unmodifiableList(options);
156+
} catch (BackingStoreException e) {
157+
return Collections.EMPTY_LIST;
158+
}
159+
}
160+
161+
public Set getOptionTriggers() {
162+
final Set triggers = new HashSet();
163+
final Iterator options = getOptions().iterator();
164+
while(options.hasNext()){
165+
final Option option = (Option)options.next();
166+
triggers.addAll(option.getTriggers());
167+
}
168+
return Collections.unmodifiableSet(triggers);
169+
}
170170
}

0 commit comments

Comments
 (0)