net.sourceforge.sqlunit.test
Class Dictionary

java.lang.Object
  extended by net.sourceforge.sqlunit.test.Dictionary
All Implemented Interfaces:
java.io.Serializable

public class Dictionary
extends java.lang.Object
implements java.io.Serializable

This class implements a simple dictionary of name value pairs which can be populated and serialized to the database as a BLOB value. This can then be retrieved using SQLUnit and converted to its String representation automatically. This is a demo of storing smart Java objects in a relational database.

Version:
$Revision: 1.4 $
Author:
Sujit Pal (spal@users.sourceforge.net)
See Also:
Serialized Form

Constructor Summary
Dictionary()
          Default Constructor.
 
Method Summary
 java.lang.String getEntry(java.lang.String key)
          Returns the value associated with the given key.
 java.util.Iterator getKeys()
          Returns an Iterator on a sorted list of keys in this Dictionary.
 void setEntry(java.lang.String key, java.lang.String value)
          Sets the value for a given key.
 java.lang.String toString()
          Render this object with its values as a String.
 void writeTo(java.lang.String fileName)
          Convenience method to write to a named file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Dictionary

public Dictionary()
Default Constructor.

Method Detail

getKeys

public final java.util.Iterator getKeys()
Returns an Iterator on a sorted list of keys in this Dictionary.

Returns:
an iterator for the keys to the Dictionary.

setEntry

public final void setEntry(java.lang.String key,
                           java.lang.String value)
Sets the value for a given key.

Parameters:
key - the key into the Dictionary.
value - the value associated with the key.

getEntry

public final java.lang.String getEntry(java.lang.String key)
Returns the value associated with the given key.

Parameters:
key - the key into the Dictionary.
Returns:
the value associated with the given key.

toString

public final java.lang.String toString()
Render this object with its values as a String.

Overrides:
toString in class java.lang.Object
Returns:
the String representation of this Object.

writeTo

public final void writeTo(java.lang.String fileName)
Convenience method to write to a named file. This is not mandated by the IJavaObject interface but helps when trying to build a test case which matches with a file.

Parameters:
fileName - A file name to write to.