You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ni...@apache.org on 2008/03/22 13:00:50 UTC
svn commit: r639981 - in
/commons/proper/cli/trunk/src/java/org/apache/commons/cli2: ./ builder/
commandline/ option/ resource/ util/
Author: niallp
Date: Sat Mar 22 05:00:48 2008
New Revision: 639981
URL: http://svn.apache.org/viewvc?rev=639981&view=rev
Log:
Remove tab characters
Modified:
commons/proper/cli/trunk/src/java/org/apache/commons/cli2/Option.java
commons/proper/cli/trunk/src/java/org/apache/commons/cli2/builder/ArgumentBuilder.java
commons/proper/cli/trunk/src/java/org/apache/commons/cli2/commandline/DefaultingCommandLine.java
commons/proper/cli/trunk/src/java/org/apache/commons/cli2/commandline/PreferencesCommandLine.java
commons/proper/cli/trunk/src/java/org/apache/commons/cli2/commandline/PropertiesCommandLine.java
commons/proper/cli/trunk/src/java/org/apache/commons/cli2/option/ArgumentImpl.java
commons/proper/cli/trunk/src/java/org/apache/commons/cli2/resource/ResourceHelper.java
commons/proper/cli/trunk/src/java/org/apache/commons/cli2/util/Comparators.java
Modified: commons/proper/cli/trunk/src/java/org/apache/commons/cli2/Option.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/java/org/apache/commons/cli2/Option.java?rev=639981&r1=639980&r2=639981&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/java/org/apache/commons/cli2/Option.java (original)
+++ commons/proper/cli/trunk/src/java/org/apache/commons/cli2/Option.java Sat Mar 22 05:00:48 2008
@@ -181,13 +181,13 @@
*/
int getId();
- /**
- * Recursively searches for an option with the supplied trigger.
- *
- * @param trigger the trigger to search for.
- * @return the matching option or null.
- */
- Option findOption(final String trigger);
+ /**
+ * Recursively searches for an option with the supplied trigger.
+ *
+ * @param trigger the trigger to search for.
+ * @return the matching option or null.
+ */
+ Option findOption(final String trigger);
/**
* Indicates whether this option is required to be present.
Modified: commons/proper/cli/trunk/src/java/org/apache/commons/cli2/builder/ArgumentBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/java/org/apache/commons/cli2/builder/ArgumentBuilder.java?rev=639981&r1=639980&r2=639981&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/java/org/apache/commons/cli2/builder/ArgumentBuilder.java (original)
+++ commons/proper/cli/trunk/src/java/org/apache/commons/cli2/builder/ArgumentBuilder.java Sat Mar 22 05:00:48 2008
@@ -30,8 +30,8 @@
*/
public class ArgumentBuilder {
- /** i18n */
- private final static ResourceHelper resources = ResourceHelper.getResourceHelper();
+ /** i18n */
+ private final static ResourceHelper resources = ResourceHelper.getResourceHelper();
/** name of the argument. Used for display and lookups in CommandLine */
private String name;
@@ -124,12 +124,12 @@
* @return this ArgumentBuilder
*/
public final ArgumentBuilder withName(final String newName) {
- if (newName == null) {
- throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_NAME));
- }
- if ("".equals(newName)) {
- throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_EMPTY_NAME));
- }
+ if (newName == null) {
+ throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_NAME));
+ }
+ if ("".equals(newName)) {
+ throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_EMPTY_NAME));
+ }
this.name = newName;
return this;
}
@@ -154,9 +154,9 @@
* @return this ArgumentBuilder
*/
public final ArgumentBuilder withMinimum(final int newMinimum) {
- if (newMinimum < 0) {
- throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NEGATIVE_MINIMUM));
- }
+ if (newMinimum < 0) {
+ throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NEGATIVE_MINIMUM));
+ }
this.minimum = newMinimum;
return this;
}
@@ -168,9 +168,9 @@
* @return this ArgumentBuilder
*/
public final ArgumentBuilder withMaximum(final int newMaximum) {
- if (newMaximum < 0) {
- throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NEGATIVE_MAXIMUM));
- }
+ if (newMaximum < 0) {
+ throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NEGATIVE_MAXIMUM));
+ }
this.maximum = newMaximum;
return this;
}
@@ -215,9 +215,9 @@
* @return this ArgumentBuilder
*/
public final ArgumentBuilder withValidator(final Validator newValidator) {
- if (newValidator == null) {
- throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_VALIDATOR));
- }
+ if (newValidator == null) {
+ throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_VALIDATOR));
+ }
this.validator = newValidator;
return this;
}
@@ -231,12 +231,12 @@
* @return this ArgumentBuilder
*/
public final ArgumentBuilder withConsumeRemaining(final String newConsumeRemaining) {
- if (newConsumeRemaining == null) {
- throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_CONSUME_REMAINING));
- }
- if ( "".equals(newConsumeRemaining)) {
- throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_EMPTY_CONSUME_REMAINING));
- }
+ if (newConsumeRemaining == null) {
+ throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_CONSUME_REMAINING));
+ }
+ if ( "".equals(newConsumeRemaining)) {
+ throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_EMPTY_CONSUME_REMAINING));
+ }
this.consumeRemaining = newConsumeRemaining;
return this;
}
@@ -248,9 +248,9 @@
* @return this ArgumentBuilder
*/
public final ArgumentBuilder withDefault(final Object defaultValue) {
- if (defaultValue == null) {
- throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_DEFAULT));
- }
+ if (defaultValue == null) {
+ throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_DEFAULT));
+ }
if (this.defaultValues == null) {
this.defaultValues = new ArrayList(1);
@@ -266,9 +266,9 @@
* @return this ArgumentBuilder
*/
public final ArgumentBuilder withDefaults(final List newDefaultValues) {
- if (newDefaultValues == null) {
- throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_DEFAULTS));
- }
+ if (newDefaultValues == null) {
+ throw new IllegalArgumentException(resources.getMessage(ResourceConstants.ARGUMENT_BUILDER_NULL_DEFAULTS));
+ }
this.defaultValues = newDefaultValues;
return this;
}
Modified: commons/proper/cli/trunk/src/java/org/apache/commons/cli2/commandline/DefaultingCommandLine.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/java/org/apache/commons/cli2/commandline/DefaultingCommandLine.java?rev=639981&r1=639980&r2=639981&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/java/org/apache/commons/cli2/commandline/DefaultingCommandLine.java (original)
+++ commons/proper/cli/trunk/src/java/org/apache/commons/cli2/commandline/DefaultingCommandLine.java Sat Mar 22 05:00:48 2008
@@ -74,7 +74,7 @@
* @return an unmodifiable iterator
*/
public Iterator commandLines(){
- return Collections.unmodifiableList(commandLines).iterator();
+ return Collections.unmodifiableList(commandLines).iterator();
}
public Option getOption(String trigger) {
@@ -132,10 +132,10 @@
}
}
if(defaultValues==null){
- return Collections.EMPTY_LIST;
+ return Collections.EMPTY_LIST;
}
else{
- return defaultValues;
+ return defaultValues;
}
}
Modified: commons/proper/cli/trunk/src/java/org/apache/commons/cli2/commandline/PreferencesCommandLine.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/java/org/apache/commons/cli2/commandline/PreferencesCommandLine.java?rev=639981&r1=639980&r2=639981&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/java/org/apache/commons/cli2/commandline/PreferencesCommandLine.java (original)
+++ commons/proper/cli/trunk/src/java/org/apache/commons/cli2/commandline/PreferencesCommandLine.java Sat Mar 22 05:00:48 2008
@@ -48,21 +48,21 @@
*/
public class PreferencesCommandLine extends CommandLineImpl {
- private static final char NUL = '\0';
- private final Preferences preferences;
- private final Option root;
- private final char separator;
+ private static final char NUL = '\0';
+ private final Preferences preferences;
+ private final Option root;
+ private final char separator;
- /**
+ /**
* Creates a new PreferencesCommandLine using the specified root Option and
* Preferences node. Argument values will be separated using the char 0.
*
- * @param root the CommandLine's root Option
- * @param preferences the Preferences node to get values from
- */
- public PreferencesCommandLine(final Option root, final Preferences preferences){
- this(root,preferences,NUL);
- }
+ * @param root the CommandLine's root Option
+ * @param preferences the Preferences node to get values from
+ */
+ public PreferencesCommandLine(final Option root, final Preferences preferences){
+ this(root,preferences,NUL);
+ }
/**
* Creates a new PreferencesCommandLine using the specified root Option,
@@ -72,99 +72,99 @@
* @param preferences the Preferences node to get values from
* @param separator the character to split argument values
*/
- public PreferencesCommandLine(final Option root, final Preferences preferences, final char separator){
- this.root = root;
- this.preferences = preferences;
- this.separator = separator;
- }
-
- public boolean hasOption(Option option) {
- if(option==null){
- return false;
- }
- else{
- try {
- return Arrays.asList(preferences.keys()).contains(option.getPreferredName());
- } catch (BackingStoreException e) {
- return false;
- }
- }
- }
-
- public Option getOption(String trigger) {
- return root.findOption(trigger);
- }
-
- public List getValues(final Option option, final List defaultValues) {
- final String value = preferences.get(option.getPreferredName(),null);
-
- if(value==null){
- return defaultValues;
- }
- else if(separator>NUL){
- final List values = new ArrayList();
- final StringTokenizer tokens = new StringTokenizer(value,String.valueOf(separator));
-
- while(tokens.hasMoreTokens()){
- values.add(tokens.nextToken());
- }
-
- return values;
- }
- else{
- return Collections.singletonList(value);
- }
- }
-
- public Boolean getSwitch(final Option option, final Boolean defaultValue) {
- final String value = preferences.get(option.getPreferredName(),null);
- if("true".equals(value)){
- return Boolean.TRUE;
- }
- else if("false".equals(value)){
- return Boolean.FALSE;
- }
- else{
- return defaultValue;
- }
- }
-
- public String getProperty(final String property, final String defaultValue) {
- return preferences.get(property, defaultValue);
- }
-
- public Set getProperties() {
- try {
- return new HashSet(Arrays.asList(preferences.keys()));
- } catch (BackingStoreException e) {
- return Collections.EMPTY_SET;
- }
- }
-
- public List getOptions() {
- try {
- final List options = new ArrayList();
- final Iterator keys = Arrays.asList(preferences.keys()).iterator();
- while (keys.hasNext()) {
- final String trigger = (String) keys.next();
- final Option option = root.findOption(trigger);
- if (option != null) {
- options.add(option);
- }
- }
- return Collections.unmodifiableList(options);
- } catch (BackingStoreException e) {
- return Collections.EMPTY_LIST;
- }
- }
-
- public Set getOptionTriggers() {
- final Set triggers = new HashSet();
- final Iterator options = getOptions().iterator();
- while(options.hasNext()){
- final Option option = (Option)options.next();
- triggers.addAll(option.getTriggers());
- }
- return Collections.unmodifiableSet(triggers);
- }
+ public PreferencesCommandLine(final Option root, final Preferences preferences, final char separator){
+ this.root = root;
+ this.preferences = preferences;
+ this.separator = separator;
+ }
+
+ public boolean hasOption(Option option) {
+ if(option==null){
+ return false;
+ }
+ else{
+ try {
+ return Arrays.asList(preferences.keys()).contains(option.getPreferredName());
+ } catch (BackingStoreException e) {
+ return false;
+ }
+ }
+ }
+
+ public Option getOption(String trigger) {
+ return root.findOption(trigger);
+ }
+
+ public List getValues(final Option option, final List defaultValues) {
+ final String value = preferences.get(option.getPreferredName(),null);
+
+ if(value==null){
+ return defaultValues;
+ }
+ else if(separator>NUL){
+ final List values = new ArrayList();
+ final StringTokenizer tokens = new StringTokenizer(value,String.valueOf(separator));
+
+ while(tokens.hasMoreTokens()){
+ values.add(tokens.nextToken());
+ }
+
+ return values;
+ }
+ else{
+ return Collections.singletonList(value);
+ }
+ }
+
+ public Boolean getSwitch(final Option option, final Boolean defaultValue) {
+ final String value = preferences.get(option.getPreferredName(),null);
+ if("true".equals(value)){
+ return Boolean.TRUE;
+ }
+ else if("false".equals(value)){
+ return Boolean.FALSE;
+ }
+ else{
+ return defaultValue;
+ }
+ }
+
+ public String getProperty(final String property, final String defaultValue) {
+ return preferences.get(property, defaultValue);
+ }
+
+ public Set getProperties() {
+ try {
+ return new HashSet(Arrays.asList(preferences.keys()));
+ } catch (BackingStoreException e) {
+ return Collections.EMPTY_SET;
+ }
+ }
+
+ public List getOptions() {
+ try {
+ final List options = new ArrayList();
+ final Iterator keys = Arrays.asList(preferences.keys()).iterator();
+ while (keys.hasNext()) {
+ final String trigger = (String) keys.next();
+ final Option option = root.findOption(trigger);
+ if (option != null) {
+ options.add(option);
+ }
+ }
+ return Collections.unmodifiableList(options);
+ } catch (BackingStoreException e) {
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ public Set getOptionTriggers() {
+ final Set triggers = new HashSet();
+ final Iterator options = getOptions().iterator();
+ while(options.hasNext()){
+ final Option option = (Option)options.next();
+ triggers.addAll(option.getTriggers());
+ }
+ return Collections.unmodifiableSet(triggers);
+ }
}
Modified: commons/proper/cli/trunk/src/java/org/apache/commons/cli2/commandline/PropertiesCommandLine.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/java/org/apache/commons/cli2/commandline/PropertiesCommandLine.java?rev=639981&r1=639980&r2=639981&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/java/org/apache/commons/cli2/commandline/PropertiesCommandLine.java (original)
+++ commons/proper/cli/trunk/src/java/org/apache/commons/cli2/commandline/PropertiesCommandLine.java Sat Mar 22 05:00:48 2008
@@ -44,10 +44,10 @@
*/
public class PropertiesCommandLine extends CommandLineImpl {
- private static final char NUL = '\0';
- private final Properties properties;
- private final Option root;
- private final char separator;
+ private static final char NUL = '\0';
+ private final Properties properties;
+ private final Option root;
+ private final char separator;
/**
* Creates a new PropertiesCommandLine using the specified root Option,
@@ -56,9 +56,9 @@
* @param root the CommandLine's root Option
* @param properties the Properties instance to get values from
*/
- public PropertiesCommandLine(final Option root, final Properties properties){
- this(root,properties,NUL);
- }
+ public PropertiesCommandLine(final Option root, final Properties properties){
+ this(root,properties,NUL);
+ }
/**
* Creates a new PropertiesCommandLine using the specified root Option,
@@ -68,88 +68,88 @@
* @param properties the Properties instance to get values from
* @param separator the character to split argument values
*/
- public PropertiesCommandLine(final Option root, final Properties properties, final char separator){
- this.root = root;
- this.properties = properties;
- this.separator = separator;
- }
-
-
- public boolean hasOption(Option option) {
- if(option==null){
- return false;
- }
- else{
- return properties.containsKey(option.getPreferredName());
- }
- }
-
- public Option getOption(String trigger) {
- return root.findOption(trigger);
- }
-
- public List getValues(final Option option, final List defaultValues) {
- final String value = properties.getProperty(option.getPreferredName());
-
- if(value==null){
- return defaultValues;
- }
- else if(separator>NUL){
- final List values = new ArrayList();
- final StringTokenizer tokens = new StringTokenizer(value,String.valueOf(separator));
-
- while(tokens.hasMoreTokens()){
- values.add(tokens.nextToken());
- }
-
- return values;
- }
- else{
- return Collections.singletonList(value);
- }
- }
-
- public Boolean getSwitch(final Option option, final Boolean defaultValue) {
- final String value = properties.getProperty(option.getPreferredName());
- if("true".equals(value)){
- return Boolean.TRUE;
- }
- else if("false".equals(value)){
- return Boolean.FALSE;
- }
- else{
- return defaultValue;
- }
- }
-
- public String getProperty(final String property, final String defaultValue) {
- return properties.getProperty(property,defaultValue);
- }
-
- public Set getProperties() {
- return properties.keySet();
- }
-
- public List getOptions() {
- final List options = new ArrayList();
- final Iterator keys = properties.keySet().iterator();
- while(keys.hasNext()){
- final String trigger = (String)keys.next();
- final Option option = root.findOption(trigger);
- if(option!=null){
- options.add(option);
- }
- }
- return Collections.unmodifiableList(options);
- }
-
- public Set getOptionTriggers() {
- final Set triggers = new HashSet();
- final Iterator options = getOptions().iterator();
- while(options.hasNext()){
- final Option option = (Option)options.next();
- triggers.addAll(option.getTriggers());
- }
- return Collections.unmodifiableSet(triggers);
- }
+ public PropertiesCommandLine(final Option root, final Properties properties, final char separator){
+ this.root = root;
+ this.properties = properties;
+ this.separator = separator;
+ }
+
+
+ public boolean hasOption(Option option) {
+ if(option==null){
+ return false;
+ }
+ else{
+ return properties.containsKey(option.getPreferredName());
+ }
+ }
+
+ public Option getOption(String trigger) {
+ return root.findOption(trigger);
+ }
+
+ public List getValues(final Option option, final List defaultValues) {
+ final String value = properties.getProperty(option.getPreferredName());
+
+ if(value==null){
+ return defaultValues;
+ }
+ else if(separator>NUL){
+ final List values = new ArrayList();
+ final StringTokenizer tokens = new StringTokenizer(value,String.valueOf(separator));
+
+ while(tokens.hasMoreTokens()){
+ values.add(tokens.nextToken());
+ }
+
+ return values;
+ }
+ else{
+ return Collections.singletonList(value);
+ }
+ }
+
+ public Boolean getSwitch(final Option option, final Boolean defaultValue) {
+ final String value = properties.getProperty(option.getPreferredName());
+ if("true".equals(value)){
+ return Boolean.TRUE;
+ }
+ else if("false".equals(value)){
+ return Boolean.FALSE;
+ }
+ else{
+ return defaultValue;
+ }
+ }
+
+ public String getProperty(final String property, final String defaultValue) {
+ return properties.getProperty(property,defaultValue);
+ }
+
+ public Set getProperties() {
+ return properties.keySet();
+ }
+
+ public List getOptions() {
+ final List options = new ArrayList();
+ final Iterator keys = properties.keySet().iterator();
+ while(keys.hasNext()){
+ final String trigger = (String)keys.next();
+ final Option option = root.findOption(trigger);
+ if(option!=null){
+ options.add(option);
+ }
+ }
+ return Collections.unmodifiableList(options);
+ }
+
+ public Set getOptionTriggers() {
+ final Set triggers = new HashSet();
+ final Iterator options = getOptions().iterator();
+ while(options.hasNext()){
+ final Option option = (Option)options.next();
+ triggers.addAll(option.getTriggers());
+ }
+ return Collections.unmodifiableSet(triggers);
+ }
}
Modified: commons/proper/cli/trunk/src/java/org/apache/commons/cli2/option/ArgumentImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/java/org/apache/commons/cli2/option/ArgumentImpl.java?rev=639981&r1=639980&r2=639981&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/java/org/apache/commons/cli2/option/ArgumentImpl.java (original)
+++ commons/proper/cli/trunk/src/java/org/apache/commons/cli2/option/ArgumentImpl.java Sat Mar 22 05:00:48 2008
@@ -215,15 +215,15 @@
}
public String getConsumeRemaining() {
- return this.consumeRemaining;
+ return this.consumeRemaining;
}
public List getDefaultValues() {
- return this.defaultValues;
+ return this.defaultValues;
}
public Validator getValidator() {
- return this.validator;
+ return this.validator;
}
public void validate(final WriteableCommandLine commandLine)
Modified: commons/proper/cli/trunk/src/java/org/apache/commons/cli2/resource/ResourceHelper.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/java/org/apache/commons/cli2/resource/ResourceHelper.java?rev=639981&r1=639980&r2=639981&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/java/org/apache/commons/cli2/resource/ResourceHelper.java (original)
+++ commons/proper/cli/trunk/src/java/org/apache/commons/cli2/resource/ResourceHelper.java Sat Mar 22 05:00:48 2008
@@ -58,12 +58,12 @@
Locale locale;
if (firstUnderscore != -1) {
- String language = bundleName.substring(firstUnderscore + 1, secondUnderscore);
- String country = bundleName.substring(secondUnderscore + 1);
- locale = new Locale(language, country);
+ String language = bundleName.substring(firstUnderscore + 1, secondUnderscore);
+ String country = bundleName.substring(secondUnderscore + 1);
+ locale = new Locale(language, country);
}
else {
- locale = Locale.getDefault();
+ locale = Locale.getDefault();
}
// initialize the bundle
try {
@@ -74,7 +74,7 @@
}
public String getBundleName() {
- return this.prop;
+ return this.prop;
}
/**
Modified: commons/proper/cli/trunk/src/java/org/apache/commons/cli2/util/Comparators.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/trunk/src/java/org/apache/commons/cli2/util/Comparators.java?rev=639981&r1=639980&r2=639981&view=diff
==============================================================================
--- commons/proper/cli/trunk/src/java/org/apache/commons/cli2/util/Comparators.java (original)
+++ commons/proper/cli/trunk/src/java/org/apache/commons/cli2/util/Comparators.java Sat Mar 22 05:00:48 2008
@@ -30,9 +30,9 @@
*/
public class Comparators {
- private Comparators(){
- // constructor hiden from potential users
- }
+ private Comparators(){
+ // constructor hiden from potential users
+ }
/**