You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by jk...@apache.org on 2003/05/24 16:44:44 UTC
cvs commit: jakarta-commons/cli/src/java/org/apache/commons/cli ParseException.java Options.java ArgumentBuilder.java AlreadySelectedException.java OptionBuilder.java MissingValueException.java MissingOptionException.java
jkeyes 2003/05/24 07:44:44
Modified: cli/src/java/org/apache/commons/cli Tag: cli_1_x
ParseException.java Options.java
ArgumentBuilder.java AlreadySelectedException.java
OptionBuilder.java MissingValueException.java
MissingOptionException.java
Log:
replaced tabs with spaces
modified some javadoc so checkstyle doesn't report it
changed TODO : to @task
Revision Changes Path
No revision
No revision
1.3.2.3 +10 -10 jakarta-commons/cli/src/java/org/apache/commons/cli/ParseException.java
Index: ParseException.java
===================================================================
RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/ParseException.java,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -u -r1.3.2.2 -r1.3.2.3
--- ParseException.java 23 May 2003 22:55:39 -0000 1.3.2.2
+++ ParseException.java 24 May 2003 14:44:43 -0000 1.3.2.3
@@ -70,15 +70,15 @@
*/
public class ParseException extends Exception {
- /**
- * Creates a ParseException and passes the detailed message
- * to its parent so the <code>getMessage</code> will
- * return the details.
- *
- * @param message
- * the details of why this exception was thrown
- */
- public ParseException( String message ) {
- super( message );
+ /**
+ * Creates a ParseException and passes the detailed message
+ * to its parent so the <code>getMessage</code> will
+ * return the details.
+ *
+ * @param message
+ * the details of why this exception was thrown
+ */
+ public ParseException(String message) {
+ super(message);
}
}
1.19.2.3 +12 -17 jakarta-commons/cli/src/java/org/apache/commons/cli/Options.java
Index: Options.java
===================================================================
RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Options.java,v
retrieving revision 1.19.2.2
retrieving revision 1.19.2.3
diff -u -r1.19.2.2 -r1.19.2.3
--- Options.java 24 May 2003 13:43:29 -0000 1.19.2.2
+++ Options.java 24 May 2003 14:44:43 -0000 1.19.2.3
@@ -71,8 +71,8 @@
* line. It can have three types of element, Option, Argument
* or OptionGroup.
*
- * TODO: consolidate the OptionGroup support
- * TODO: consolidate the AnonymousArgument support
+ * @task consolidate the OptionGroup support
+ * @task consolidate the AnonymousArgument support
*
* @author John Keyes
*/
@@ -161,8 +161,7 @@
* value that is returned is a new object so changes made
* to it do not modify this definition.
*
- * @return
- * the Set of command line Options
+ * @return the Set of command line Options
*/
public Set getOptions() {
return new HashSet(options.values());
@@ -177,8 +176,7 @@
* @param name
* the name of the Option to search for
*
- * @return
- * the Option that matches the search criteria, otherwise null
+ * @return the Option that matches the search criteria, otherwise null
*/
Option getOption(String name) {
Option option = null;
@@ -201,8 +199,7 @@
/**
* Return the number of command line options in this definition
*
- * @return
- * the number of Options
+ * @return the number of Options
*/
public int size() {
return this.options.size();
@@ -213,8 +210,7 @@
* The value that is returned is a new object so changes made
* to it do not modify this definition.
*
- * @return
- * the Set of required command line Options
+ * @return the Set of required command line Options
*/
public Set getRequired() {
return new HashSet(required);
@@ -225,8 +221,7 @@
* The value that is returned is a new object so changes made
* to it do not modify this definition.
*
- * @return
- * the Set of command line OptionGroups
+ * @return the Set of command line OptionGroups
*/
public Set getOptionGroups() {
return new HashSet(this.groups);
@@ -247,8 +242,7 @@
* Returns whether this definition has an AnonymousArgument
* specified.
*
- * @return
- * true if there is an AnonymousArgument specified, otherwise false
+ * @return true if there is an AnonymousArgument specified, otherwise false
*/
public boolean hasAnonymousArgument() {
return this.anonymousArgument != null;
@@ -257,8 +251,7 @@
/**
* Return this definitions AnonymousArgument
*
- * @return
- * the Argument if one was specified, otherwise null
+ * @return the Argument if one was specified, otherwise null
*/
public Argument getAnonymousArgument() {
return this.anonymousArgument;
@@ -270,6 +263,7 @@
* Set.
*
* @param groups
+ * a Set of OptionGroups
*/
public void setOptionGroups(Set groups) {
this.groups = groups;
@@ -282,10 +276,11 @@
* Adds the individual Options from the specified group
* to the options definition.
*
- * TODO: review this behaviour as it corrupts the contract
+ * @task review this behaviour as it corrupts the contract
* for getOptions.
*
* @param group
+ * an OptionGroup to add to this definition
*/
private void addGroupOptions(OptionGroup group) {
for (Iterator iter = group.getOptions().iterator(); iter.hasNext();) {
1.1.2.4 +161 -165 jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/ArgumentBuilder.java
Index: ArgumentBuilder.java
===================================================================
RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/ArgumentBuilder.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- ArgumentBuilder.java 21 May 2003 21:03:36 -0000 1.1.2.3
+++ ArgumentBuilder.java 24 May 2003 14:44:43 -0000 1.1.2.4
@@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -74,66 +74,74 @@
*/
public class ArgumentBuilder {
- /** the name of the argument */
+ /** the name of the argument */
private String name;
-
+
/** the long name of the argument */
private String longName;
-
+
/** a textual description of the arguments purpose */
private String description;
-
+
/** specifies whether the argument is required, by default false */
private boolean required;
-
+
/** the set of children this argument has */
private Set children;
-
+
/**
* the value separator e.g. if this is ',' and the value is
* 'a,b,c' then the argument has three values 'a', 'b' and 'c'.
*/
private char valueSeparator;
-
+
/** a textual description of the value */
private String valueName;
-
+
/** the number of values this argument has */
private int size = 1;
-
+
/** the type of the argument value */
private Class type;
-
+
/** specifies whether the values can be omitted, by default false */
private boolean hasOptionalValues;
- /**
- * Creates ArgumentBuilder instances.
- *
- * @return
- * an ArgumentBuilder instance
- */
- public static ArgumentBuilder createBuilder() {
- return new ArgumentBuilder();
- }
-
- /**
- * Creates an Argument instance, based on the state of the builder
- *
- * @return an Argument instance
- */
+ /**
+ * Creates ArgumentBuilder instances.
+ *
+ * @return an ArgumentBuilder instance
+ */
+ public static ArgumentBuilder createBuilder() {
+ return new ArgumentBuilder();
+ }
+
+ /**
+ * Creates an Argument instance, based on the state of the builder
+ *
+ * @return an Argument instance
+ */
public Argument create() {
try {
- return new ArgumentImpl( this.name, this.longName, this.description, this.required, this.size, this.type, this.valueSeparator, this.valueName, this.hasOptionalValues, this.children );
- }
- finally {
- // reset the state of the builder
+ return new ArgumentImpl(
+ this.name,
+ this.longName,
+ this.description,
+ this.required,
+ this.size,
+ this.type,
+ this.valueSeparator,
+ this.valueName,
+ this.hasOptionalValues,
+ this.children);
+ } finally {
+ // reset the state of the builder
reset();
}
}
-
+
/**
- * TODO: revise the behaviour of anonymous arguments
+ * @task revise the behaviour of anonymous arguments
*
* Creates an anonymous argument, using the specified name for the
* help text
@@ -141,189 +149,177 @@
* @param name
* the textual description of this argument for use in the help text
*
- * @return
- * the anonymous argument instance
+ * @return the anonymous argument instance
*/
- public Argument createAnonymous( final String name ) {
- return new AnonymousArgumentImpl( name );
+ public Argument createAnonymous(final String name) {
+ return new AnonymousArgumentImpl(name);
}
-
- /**
- * Sets the name of the next Argument instance to be created
- *
- * @param name
- * the name of the Argument
- *
- * @return
- * the ArgumentBuilder
- */
- public ArgumentBuilder withName( final String name ) {
- this.name = name;
- return this;
- }
-
- /**
- * Sets the long name of the next Argument instance to be created
- *
- * @param longName
- * the long name of the Argument
- *
- * @return
- * the ArgumentBuilder
- */
- public ArgumentBuilder withLongName( final String longName ) {
- this.longName = longName;
- return this;
- }
-
- /**
- * Sets the description of the next Argument instance to be created
- *
- * @param description
- * the textual description of the argument for use in the help text
- *
- * @return
- * the ArgumentBuilder
- */
- public ArgumentBuilder withDescription( String description ) {
+
+ /**
+ * Sets the name of the next Argument instance to be created
+ *
+ * @param name
+ * the name of the Argument
+ *
+ * @return the ArgumentBuilder
+ */
+ public ArgumentBuilder withName(final String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * Sets the long name of the next Argument instance to be created
+ *
+ * @param longName
+ * the long name of the Argument
+ *
+ * @return the ArgumentBuilder
+ */
+ public ArgumentBuilder withLongName(final String longName) {
+ this.longName = longName;
+ return this;
+ }
+
+ /**
+ * Sets the description of the next Argument instance to be created
+ *
+ * @param description
+ * the textual description of the argument for use in the help text
+ *
+ * @return the ArgumentBuilder
+ */
+ public ArgumentBuilder withDescription(String description) {
this.description = description;
return this;
}
- /**
- * Sets whether the next Argument instance created will be required
- *
- * @param required
- * if true, the next Argument must be present when the command line
- * is parsed, otherwise it does not
- *
- * @return
- * the ArgumentBuilder
- */
+ /**
+ * Sets whether the next Argument instance created will be required
+ *
+ * @param required
+ * if true, the next Argument must be present when the command line
+ * is parsed, otherwise it does not
+ *
+ * @return the ArgumentBuilder
+ */
public ArgumentBuilder withRequired(boolean required) {
this.required = required;
return this;
}
- /**
- * Adds the specified child to the next Argument instance that will
- * be created.
- *
- * @param child
- * the child Option of the next Argument
- *
- * @return
- * the ArgumentBuilder
- */
- public ArgumentBuilder withChild( final Option child ) {
- if(this.children == null) {
+ /**
+ * Adds the specified child to the next Argument instance that will
+ * be created.
+ *
+ * @param child
+ * the child Option of the next Argument
+ *
+ * @return the ArgumentBuilder
+ */
+ public ArgumentBuilder withChild(final Option child) {
+ if (this.children == null) {
this.children = new HashSet();
}
this.children.add(child);
return this;
}
- /**
- * Adds the set of children to the next Argument instance that will
- * be created.
- *
- * @param children
- * the set of child Options of the next Argument
- *
- * @return
- * the ArgumentBuilder
- */
- public ArgumentBuilder withChildren( final Set children ) {
- if(this.children == null) {
+ /**
+ * Adds the set of children to the next Argument instance that will
+ * be created.
+ *
+ * @param children
+ * the set of child Options of the next Argument
+ *
+ * @return the ArgumentBuilder
+ */
+ public ArgumentBuilder withChildren(final Set children) {
+ if (this.children == null) {
this.children = new HashSet();
}
this.children.addAll(children);
return this;
}
- /**
- * Sets the value separator of the next Argument instance that will
- * be created.
- *
- * @param valueSeparator
- * the character that separates the values
- *
- * @return
- * the ArgumentBuilder
- */
- public ArgumentBuilder withValueSeparator( final char valueSeparator ) {
+ /**
+ * Sets the value separator of the next Argument instance that will
+ * be created.
+ *
+ * @param valueSeparator
+ * the character that separates the values
+ *
+ * @return the ArgumentBuilder
+ */
+ public ArgumentBuilder withValueSeparator(final char valueSeparator) {
this.valueSeparator = valueSeparator;
return this;
}
- /**
- * Sets the name of the Argument value that will be used in the
- * help text.
- *
- * @param valueName
- * the description of the value for help text
- *
- * @return
- * the ArgumentBuilder
- */
- public ArgumentBuilder withValueName( final String valueName ) {
+ /**
+ * Sets the name of the Argument value that will be used in the
+ * help text.
+ *
+ * @param valueName
+ * the description of the value for help text
+ *
+ * @return the ArgumentBuilder
+ */
+ public ArgumentBuilder withValueName(final String valueName) {
this.valueName = valueName;
return this;
}
- /**
- * Sets the number of values the next Argument created will have.
- *
- * @param size
- * the number of values
- *
- * @return
- * the ArgumentBuilder
- */
- public ArgumentBuilder withSize( final int size ) {
+ /**
+ * Sets the number of values the next Argument created will have.
+ *
+ * @param size
+ * the number of values
+ *
+ * @return the ArgumentBuilder
+ */
+ public ArgumentBuilder withSize(final int size) {
this.size = size;
return this;
}
- /**
- * Sets the type of the value of the next Argument to be created.
- *
- * @param type
- * the class type of the argument value e.g. Integer.class
- *
- * @return
- * the ArgumentBuilder
- */
- public ArgumentBuilder withValueType( final Class type ) {
+ /**
+ * Sets the type of the value of the next Argument to be created.
+ *
+ * @param type
+ * the class type of the argument value e.g. Integer.class
+ *
+ * @return the ArgumentBuilder
+ */
+ public ArgumentBuilder withValueType(final Class type) {
this.type = type;
return this;
}
-
+
/**
* Sets whether the values of the next Argument to be created
* are required or not.
*
* @param optional
- * if true, the next Argument must be present when the command line
- * is parsed, otherwise it does not
+ * if true, the next Argument must be present when the command line
+ * is parsed, otherwise it does not
*
- * @return
- * the ArgumentBuilder
+ * @return the ArgumentBuilder
*/
public ArgumentBuilder withOptionalValues(final boolean optional) {
- this.hasOptionalValues = optional;
- return this;
+ this.hasOptionalValues = optional;
+ return this;
}
- /**
- * Resets the state of the builder.
- */
+ /**
+ * Resets the state of the builder.
+ */
private void reset() {
this.name = null;
this.longName = null;
this.required = false;
this.children = null;
- this.valueSeparator = (char)0;
+ this.valueSeparator = (char) 0;
this.valueName = null;
this.size = 1;
this.type = null;
1.5.2.3 +11 -11 jakarta-commons/cli/src/java/org/apache/commons/cli/AlreadySelectedException.java
Index: AlreadySelectedException.java
===================================================================
RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/AlreadySelectedException.java,v
retrieving revision 1.5.2.2
retrieving revision 1.5.2.3
diff -u -r1.5.2.2 -r1.5.2.3
--- AlreadySelectedException.java 23 May 2003 22:42:46 -0000 1.5.2.2
+++ AlreadySelectedException.java 24 May 2003 14:44:43 -0000 1.5.2.3
@@ -68,16 +68,16 @@
* @since 1.0
*/
public class AlreadySelectedException extends ParseException {
-
- /**
- * Creates an AlreadySelectedException, with the details
- * of why the exception was thrown in the specified
- * message.
- *
- * @param message
- * text explaining why this exception was thrown.
- */
- public AlreadySelectedException( String message ) {
- super( message );
+
+ /**
+ * Creates an AlreadySelectedException, with the details
+ * of why the exception was thrown in the specified
+ * message.
+ *
+ * @param message
+ * text explaining why this exception was thrown.
+ */
+ public AlreadySelectedException(String message) {
+ super(message);
}
}
1.15.2.4 +100 -105 jakarta-commons/cli/src/java/org/apache/commons/cli/OptionBuilder.java
Index: OptionBuilder.java
===================================================================
RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/OptionBuilder.java,v
retrieving revision 1.15.2.3
retrieving revision 1.15.2.4
diff -u -r1.15.2.3 -r1.15.2.4
--- OptionBuilder.java 21 May 2003 21:47:12 -0000 1.15.2.3
+++ OptionBuilder.java 24 May 2003 14:44:43 -0000 1.15.2.4
@@ -7,7 +7,7 @@
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -75,144 +75,139 @@
public class OptionBuilder {
- /** the name of the option */
+ /** the name of the option */
private String name;
-
+
/** the long name of the option */
private String longName;
-
+
/** the textual description of the option */
private String description;
-
+
/** specifies whether the option is required, default false */
private boolean required;
-
+
/** the set of children this option has */
private Set children;
- /**
- * Creates OptionBuilder instances
- *
- * @return
- * an OptionBuilder
- */
- public static OptionBuilder createBuilder() {
- return new OptionBuilder();
- }
-
- /**
- * Creates an Option instance, based on the state of the builder
- *
- * @return
- * an Option instance
- */
+ /**
+ * Creates OptionBuilder instances
+ *
+ * @return an OptionBuilder
+ */
+ public static OptionBuilder createBuilder() {
+ return new OptionBuilder();
+ }
+
+ /**
+ * Creates an Option instance, based on the state of the builder
+ *
+ * @return an Option instance
+ */
public Option create() {
try {
- return new OptionImpl( this.name, this.longName, this.description, this.required, this.children );
- }
- finally {
- // reset the state of the builder
+ return new OptionImpl(
+ this.name,
+ this.longName,
+ this.description,
+ this.required,
+ this.children);
+ } finally {
+ // reset the state of the builder
reset();
}
}
- /**
- * Sets the name of the next Option instance to be created
- *
- * @param name
- * the name of the Option
- *
- * @return
- * the OptionBuilder
- */
- public OptionBuilder withName (String name) {
- this.name = name;
- return this;
- }
-
- /**
- * Sets the long name of the next Option instance to be created
- *
- * @param longName
- * the long name of the Option
- *
- * @return
- * the OptionBuilder
- */
- public OptionBuilder withLongName (String longName) {
- this.longName = longName;
- return this;
- }
-
- /**
- * Sets the description of the next Option instance to be created
- *
- * @param description
- * the textual description of the option for use in the help text
- *
- * @return
- * the OptionBuilder
- */
- public OptionBuilder withDescription( String description ) {
- this.description = description;
+ /**
+ * Sets the name of the next Option instance to be created
+ *
+ * @param name
+ * the name of the Option
+ *
+ * @return the OptionBuilder
+ */
+ public OptionBuilder withName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * Sets the long name of the next Option instance to be created
+ *
+ * @param longName
+ * the long name of the Option
+ *
+ * @return the OptionBuilder
+ */
+ public OptionBuilder withLongName(String longName) {
+ this.longName = longName;
return this;
}
+ /**
+ * Sets the description of the next Option instance to be created
+ *
+ * @param description
+ * the textual description of the option for use in the help text
+ *
+ * @return the OptionBuilder
+ */
+ public OptionBuilder withDescription(String description) {
+ this.description = description;
+ return this;
+ }
- /**
- * Sets whether the next Option instance created will be required
- *
- * @param required
- * if true, the next Option must be present when the command line
- * is parsed, otherwise it does not
- *
- * @return
- * the OptionBuilder
- */
+ /**
+ * Sets whether the next Option instance created will be required
+ *
+ * @param required
+ * if true, the next Option must be present when the command line
+ * is parsed, otherwise it does not
+ *
+ * @return the OptionBuilder
+ */
public OptionBuilder withRequired(boolean required) {
this.required = required;
return this;
}
- /**
- * Adds the specified child to the next Option instance that will
- * be created.
- *
- * @param child
- * the child Option of the next Option
- *
- * @return
- * the OptionBuilder
- */
- public OptionBuilder withChild( final Option child ) {
- if(this.children == null) {
+ /**
+ * Adds the specified child to the next Option instance that will
+ * be created.
+ *
+ * @param child
+ * the child Option of the next Option
+ *
+ * @return the OptionBuilder
+ */
+ public OptionBuilder withChild(final Option child) {
+ if (this.children == null) {
this.children = new HashSet();
}
this.children.add(child);
return this;
}
- /**
- * Adds the set of children to the next Option instance that will
- * be created.
- *
- * @param children
- * the set of child Options of the next Option
- *
- * @return
- * the OptionBuilder
- */
- public OptionBuilder withChildren( final Set children ) {
- if(this.children == null) {
+ /**
+ * Adds the set of children to the next Option instance that will
+ * be created.
+ *
+ * @param children
+ * the set of child Options of the next Option
+ *
+ * @return the OptionBuilder
+ */
+ public OptionBuilder withChildren(final Set children) {
+ if (this.children == null) {
this.children = new HashSet();
}
this.children.addAll(children);
return this;
}
- /**
- * Resets the state of the builder.
- */
+ /**
+ * Resets the state of the builder.
+ */
private void reset() {
this.name = null;
this.longName = null;
1.1.2.3 +11 -11 jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/MissingValueException.java
Index: MissingValueException.java
===================================================================
RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/MissingValueException.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- MissingValueException.java 23 May 2003 22:55:39 -0000 1.1.2.2
+++ MissingValueException.java 24 May 2003 14:44:43 -0000 1.1.2.3
@@ -69,14 +69,14 @@
*/
public class MissingValueException extends ParseException {
- /**
- * Creates an MissingValueException, with the details
- * of why the exception was thrown in the specified
- * message.
- *
- * @param message
- * text explaining why this exception was thrown.
- */
+ /**
+ * Creates an MissingValueException, with the details
+ * of why the exception was thrown in the specified
+ * message.
+ *
+ * @param message
+ * text explaining why this exception was thrown.
+ */
public MissingValueException(String message) {
super(message);
}
1.4.2.3 +8 -8 jakarta-commons/cli/src/java/org/apache/commons/cli/MissingOptionException.java
Index: MissingOptionException.java
===================================================================
RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/MissingOptionException.java,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -u -r1.4.2.2 -r1.4.2.3
--- MissingOptionException.java 23 May 2003 22:55:39 -0000 1.4.2.2
+++ MissingOptionException.java 24 May 2003 14:44:43 -0000 1.4.2.3
@@ -69,14 +69,14 @@
*/
public class MissingOptionException extends ParseException {
- /**
- * Creates a MissingOptionException, with the details
- * of why the exception was thrown in the specified
- * message.
- *
- * @param message
- * text explaining why this exception was thrown.
- */
+ /**
+ * Creates a MissingOptionException, with the details
+ * of why the exception was thrown in the specified
+ * message.
+ *
+ * @param message
+ * text explaining why this exception was thrown.
+ */
public MissingOptionException(String message) {
super(message);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org