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();
   
  +     }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to