You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by hu...@apache.org on 2003/09/29 17:44:40 UTC
cvs commit: jakarta-commons-sandbox/chain/src/java/org/apache/commons/chain/impl CatalogBase.java
husted 2003/09/29 08:44:40
Modified: chain/src/java/org/apache/commons/chain/impl
CatalogBase.java
Log:
Apply contributions by Matthew Sgarlata, #23469
Revision Changes Path
1.4 +40 -6 jakarta-commons-sandbox/chain/src/java/org/apache/commons/chain/impl/CatalogBase.java
Index: CatalogBase.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/chain/src/java/org/apache/commons/chain/impl/CatalogBase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CatalogBase.java 31 Aug 2003 21:50:53 -0000 1.3
+++ CatalogBase.java 29 Sep 2003 15:44:40 -0000 1.4
@@ -75,6 +75,7 @@
* also be used as the basis for more advanced implementations.</p>
*
* @author Craig R. McClanahan
+ * @author Matthew J. Sgarlata
* @version $Revision$ $Date$
*/
@@ -93,13 +94,21 @@
// --------------------------------------------------------- Public Methods
+ /**
+ * Adds a Command to this Catalog.
+ * @param name the name by which the Command can be identified
+ * @param command the Command to add to this Catalog
+ */
public void addCommand(String name, Command command) {
commands.put(name, command);
}
-
+ /**
+ * Retrieves the Command identified by the given name from this Catalog.
+ * @return the Command identified by the given name from this Catalog
+ */
public Command getCommand(String name) {
return ((Command) commands.get(name));
@@ -107,12 +116,37 @@
}
-
+ /**
+ * Returns an Iterator which can be used to iterate through all the Commands
+ * in the Catalog.
+ * @return an Iterator which can be used to iterate through all the Commands
+ * in the Catalog
+ */
public Iterator getNames() {
return (commands.keySet().iterator());
}
+ /**
+ * Converts this Catalog to a String. Useful for debugging purposes.
+ * @return a representation of this catalog as a String
+ */
+ public String toString() {
+
+ Iterator names = getNames();
+ StringBuffer str =
+ new StringBuffer("[" + this.getClass().getName() + ": ");
+
+ while (names.hasNext()) {
+ str.append(names.next());
+ if (names.hasNext()) {
+ str.append(", ");
+ }
+ }
+ str.append("]");
+
+ return str.toString();
+ }
}
Re: cvs commit: jakarta-commons-sandbox/chain/src/java/org/apache/commons/chain/impl
CatalogBase.java
Posted by "Craig R. McClanahan" <cr...@apache.org>.
husted@apache.org wrote:
>husted 2003/09/29 08:44:40
>
> Modified: chain/src/java/org/apache/commons/chain/impl
> CatalogBase.java
> Log:
> Apply contributions by Matthew Sgarlata, #23469
>
> Revision Changes Path
> 1.4 +40 -6 jakarta-commons-sandbox/chain/src/java/org/apache/commons/chain/impl/CatalogBase.java
>
> Index: CatalogBase.java
> ===================================================================
> RCS file: /home/cvs/jakarta-commons-sandbox/chain/src/java/org/apache/commons/chain/impl/CatalogBase.java,v
> retrieving revision 1.3
> retrieving revision 1.4
> diff -u -r1.3 -r1.4
> --- CatalogBase.java 31 Aug 2003 21:50:53 -0000 1.3
> +++ CatalogBase.java 29 Sep 2003 15:44:40 -0000 1.4
> @@ -75,6 +75,7 @@
> * also be used as the basis for more advanced implementations.</p>
> *
> * @author Craig R. McClanahan
> + * @author Matthew J. Sgarlata
> * @version $Revision$ $Date$
> */
>
> @@ -93,13 +94,21 @@
> // --------------------------------------------------------- Public Methods
>
>
> + /**
> + * Adds a Command to this Catalog.
> + * @param name the name by which the Command can be identified
> + * @param command the Command to add to this Catalog
> + */
>
These changes are not necessary and should be removed. In an
implementation class, Javadoc automatically picks up the Javadocs from
the interface that is being implemented -- doing it this way means you
need to maintain the text in parallel.
Same goes for all the other similar changes below.
> public void addCommand(String name, Command command) {
>
> commands.put(name, command);
>
> }
>
> -
> + /**
> + * Retrieves the Command identified by the given name from this Catalog.
> + * @return the Command identified by the given name from this Catalog
> + */
> public Command getCommand(String name) {
>
> return ((Command) commands.get(name));
> @@ -107,12 +116,37 @@
> }
>
>
> -
> + /**
> + * Returns an Iterator which can be used to iterate through all the Commands
> + * in the Catalog.
> + * @return an Iterator which can be used to iterate through all the Commands
> + * in the Catalog
> + */
> public Iterator getNames() {
>
> return (commands.keySet().iterator());
>
> }
>
> + /**
> + * Converts this Catalog to a String. Useful for debugging purposes.
> + * @return a representation of this catalog as a String
> + */
> + public String toString() {
> +
> + Iterator names = getNames();
> + StringBuffer str =
> + new StringBuffer("[" + this.getClass().getName() + ": ");
> +
> + while (names.hasNext()) {
> + str.append(names.next());
> + if (names.hasNext()) {
> + str.append(", ");
> + }
> + }
> + str.append("]");
> +
> + return str.toString();
>
> + }
> }
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
Re: cvs commit: jakarta-commons-sandbox/chain/src/java/org/apache/commons/chain/impl
CatalogBase.java
Posted by "Craig R. McClanahan" <cr...@apache.org>.
husted@apache.org wrote:
>husted 2003/09/29 08:44:40
>
> Modified: chain/src/java/org/apache/commons/chain/impl
> CatalogBase.java
> Log:
> Apply contributions by Matthew Sgarlata, #23469
>
> Revision Changes Path
> 1.4 +40 -6 jakarta-commons-sandbox/chain/src/java/org/apache/commons/chain/impl/CatalogBase.java
>
> Index: CatalogBase.java
> ===================================================================
> RCS file: /home/cvs/jakarta-commons-sandbox/chain/src/java/org/apache/commons/chain/impl/CatalogBase.java,v
> retrieving revision 1.3
> retrieving revision 1.4
> diff -u -r1.3 -r1.4
> --- CatalogBase.java 31 Aug 2003 21:50:53 -0000 1.3
> +++ CatalogBase.java 29 Sep 2003 15:44:40 -0000 1.4
> @@ -75,6 +75,7 @@
> * also be used as the basis for more advanced implementations.</p>
> *
> * @author Craig R. McClanahan
> + * @author Matthew J. Sgarlata
> * @version $Revision$ $Date$
> */
>
> @@ -93,13 +94,21 @@
> // --------------------------------------------------------- Public Methods
>
>
> + /**
> + * Adds a Command to this Catalog.
> + * @param name the name by which the Command can be identified
> + * @param command the Command to add to this Catalog
> + */
>
These changes are not necessary and should be removed. In an
implementation class, Javadoc automatically picks up the Javadocs from
the interface that is being implemented -- doing it this way means you
need to maintain the text in parallel.
Same goes for all the other similar changes below.
> public void addCommand(String name, Command command) {
>
> commands.put(name, command);
>
> }
>
> -
> + /**
> + * Retrieves the Command identified by the given name from this Catalog.
> + * @return the Command identified by the given name from this Catalog
> + */
> public Command getCommand(String name) {
>
> return ((Command) commands.get(name));
> @@ -107,12 +116,37 @@
> }
>
>
> -
> + /**
> + * Returns an Iterator which can be used to iterate through all the Commands
> + * in the Catalog.
> + * @return an Iterator which can be used to iterate through all the Commands
> + * in the Catalog
> + */
> public Iterator getNames() {
>
> return (commands.keySet().iterator());
>
> }
>
> + /**
> + * Converts this Catalog to a String. Useful for debugging purposes.
> + * @return a representation of this catalog as a String
> + */
> + public String toString() {
> +
> + Iterator names = getNames();
> + StringBuffer str =
> + new StringBuffer("[" + this.getClass().getName() + ": ");
> +
> + while (names.hasNext()) {
> + str.append(names.next());
> + if (names.hasNext()) {
> + str.append(", ");
> + }
> + }
> + str.append("]");
> +
> + return str.toString();
>
> + }
> }
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org