--- projects/cms/source/util/uk/org/iscream/cms/util/XMLPacket.java 2000/11/22 08:40:53 1.1 +++ projects/cms/source/util/uk/org/iscream/cms/util/XMLPacket.java 2000/11/30 02:38:17 1.5 @@ -1,14 +1,34 @@ +//---PACKAGE DECLARATION--- +package uk.ac.ukc.iscream.util; + +//---IMPORTS--- import java.util.HashMap; -// Paul Mutton, pjm2@ukc.ac.uk - -// Object in which to store incoming XML data -// to be passed around the CORBA system. +/** + * Object in which to store incoming XML data + * to be passed around the CORBA system. + * + * @author $Author: ajm $ + * @version $Id: XMLPacket.java,v 1.5 2000/11/30 02:38:17 ajm Exp $ + */ public class XMLPacket { +//---FINAL ATTRIBUTES--- + + /** + * The current CVS revision of this class + */ + public final String REVISION = "$Revision: 1.5 $"; + +//---STATIC METHODS--- + +//---CONSTRUCTORS--- + +//---PUBLIC METHODS--- + // Add a key and value pair to the HashMap. public synchronized void addParam (String key, String value) { - params.put(key, value); + _params.put(key, value); // debug by println ;-) // System.out.println("Adding to hash: " + key + " = " + value); // end debug code @@ -19,15 +39,33 @@ public class XMLPacket { // this should not necessarily indicate that the key // does not exist. public synchronized String getParam (String key) { - return (String)params.get(key); + return (String) _params.get(key); } // Print out the entire HashMap. // (Mainly for assisting debugging.) - public synchronized void printAll () { - System.out.println(params); + public synchronized String printAll () { + return _params.toString(); } - private HashMap params = new HashMap(); - -} + /** + * Overrides the {@link java.lang.Object#toString() Object.toString()} + * method to provide clean logging (every class should have this). + * + * @return the name of this class and its CVS revision + */ + public String toString() { + return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")"; + } + +//---PRIVATE METHODS--- + +//---ACCESSOR/MUTATOR METHODS--- + +//---ATTRIBUTES--- + + private HashMap _params = new HashMap(); + +//---STATIC ATTRIBUTES--- + +} \ No newline at end of file