com.huguesjohnson.tiamat
Class StringTable

java.lang.Object
  extended by com.huguesjohnson.tiamat.StringTable
All Implemented Interfaces:
Storable, java.lang.Cloneable

public class StringTable
extends java.lang.Object
implements Storable, java.lang.Cloneable

StringTable - stores key-value pairs of strings

Author:
Hugues Johnson

Constructor Summary
StringTable()
          Creates an empty StringTable.
 
Method Summary
 StringTable clone()
           
 java.lang.String get(java.lang.String key, java.lang.String defaultValue)
          Returns the entry with the specified key, defaultValue if not found.
 java.lang.String[][] getAll()
          Returns all key-value pairs in the collection, [0][n]=key for item n, [1][n]=value for item n.
 java.util.Properties getProperties()
          Returns the Properties object this StringTable contains.
 void onDeserialize(Formatter formatter, java.lang.String absoluteDir)
          The onDeserialize event should be fired after an object is de-serialized.
 void set(java.lang.String key, java.lang.String value)
          Sets an entry in the table.
 void setProperties(java.util.Properties table)
          Sets the Properties object this StringTable contains.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringTable

public StringTable()
Creates an empty StringTable.

Method Detail

getProperties

public java.util.Properties getProperties()
Returns the Properties object this StringTable contains.

Returns:
The Properties object this StringTable contains.

setProperties

public void setProperties(java.util.Properties table)
Sets the Properties object this StringTable contains.

Parameters:
table - The new Properties object for this StringTable.

set

public void set(java.lang.String key,
                java.lang.String value)
Sets an entry in the table.

Parameters:
key - The key for the entry.
value - The value for the entry.

get

public java.lang.String get(java.lang.String key,
                            java.lang.String defaultValue)
Returns the entry with the specified key, defaultValue if not found.

Parameters:
key - The key for the entry to return.
defaultValue - The default value if the key is not found.
Returns:
The entry with the specified key, defaultValue if not found.

getAll

public java.lang.String[][] getAll()
Returns all key-value pairs in the collection, [0][n]=key for item n, [1][n]=value for item n.

Returns:
All key-value pairs in the collection.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of the object.

onDeserialize

public void onDeserialize(Formatter formatter,
                          java.lang.String absoluteDir)
The onDeserialize event should be fired after an object is de-serialized. This allows objects to load transient members, set their working directory, and load Storable members if needed.

Specified by:
onDeserialize in interface Storable
Parameters:
formatter - the formatter to use to load any storable members
absoluteDir - the working directory since all paths stored in the object should be relative

clone

public StringTable clone()
Overrides:
clone in class java.lang.Object


Copyright © 2004-2006 Hugues Johnson