Class COM.odi.util.OSDictionary

java.lang.Object
   |
   +----COM.odi.util.OSDictionary

public class OSDictionary
extends Object
implements IPersistent, Serializable
OSDictionary is an abstract superclass that specifies the protocol for persistent association mechanisms. The interface is similar to java.util.Dictionary for ease of code conversion.

See Also:
IPersistent, Dictionary

Constructor Index

 o OSDictionary()
Constructs a new dictionary.
 o OSDictionary(ClassInfo)
Constructs a new hollow dictionary.

Method Index

 o clear()
Removes all entries from the dictionary.
 o clearContents()
Resets the values of the fields of an active persistent object to the default initial values of that class of object.
 o clearDestroyed()
Removes from the hash table all entries which reference destroyed objects either as a key or value.
 o clone()
Clones the object.
 o contains(Object)
Checks whether or not the dictionary contains the specified value as an element.
 o containsKey(Object)
Checks whether or not the dictionary contains an element with the specified key.
 o elements()
Returns an enumeration of the elements in the dictionary.
 o flushContents(GenericObject)
Stores the values of the fields of an active persistent object in an instance of GenericObject.
 o get(Object)
Obtains the element mapped at the specified key.
 o getKey(Object)
Returns the actual key stored for the given key.
 o hashCode()
Returns the hash code for the object.
 o initializeContents(GenericObject)
Initializes the values of the fields of a hollow persistent object from data contained in an instance of GenericObject.
 o isEmpty()
Returns true if the number of keys in the dictionary is zero.
 o keys()
Returns an enumeration of the keys in the dictionary.
 o put(Object, Object)
Enters the mapping of key to value in the dictionary.
 o remove(Object)
Removes any existing mapping at the specified key.
 o size()
Returns the number of keys in the dictionary.

Constructors

 o OSDictionary
  protected OSDictionary(ClassInfo ignored)
Constructs a new hollow dictionary. This constructor should be used only for that purpose

 o OSDictionary
  protected OSDictionary()
Constructs a new dictionary.

Methods

 o initializeContents
  public void initializeContents(GenericObject genObject)
Initializes the values of the fields of a hollow persistent object from data contained in an instance of GenericObject. ObjectStore arranges to call this method when an application calls fetch() or dirty() on a persistent object. If you define a subclass of this class, you must define a method that overrides this method and initializes all fields in the hollow persistent object, including any fields defined by superclasses. Initialize superclass fields by invoking initializeContents() on the superclass. This is similar to calls to superclass constructors, although in this case the superclass initialization is not enforced by the compiler.

Parameters:
genObject - The representation of the persistent object that the method should read the field values from.

See Also:
initializeContents
 o flushContents
  public void flushContents(GenericObject genObject)
Stores the values of the fields of an active persistent object in an instance of GenericObject. ObjectStore arranges to call this method when a modified persistent object is evicted and when a transaction is committed. If you define a subclass of this class, you must define a method that overrides this method and stores all fields, even fields that were not modified.

Parameters:
genObject - The representation of the persistent object that this method should write the field values into.

See Also:
flushContents
 o clearContents
  public void clearContents()
Resets the values of the fields of an active persistent object to the default initial values of that class of object. This causes the object to become a stale persistent object. If you define a subclass of this class, you must define a method that overrides this method and that invokes clearContents() on its superclass to ensure that all fields are correctly cleared.

See Also:
clearContents
 o hashCode
  public int hashCode()
Returns the hash code for the object.

Overrides:
hashCode in class Object
 o clone
  public synchronized Object clone() throws CloneNotSupportedException
Clones the object.

Returns:
The cloned object.

Throws: CloneNotSupportedException
If the subclass of OSDictionary does not implement the Cloneable interface.
Overrides:
clone in class Object
 o size
  public abstract int size()
Returns the number of keys in the dictionary.

 o isEmpty
  public abstract boolean isEmpty()
Returns true if the number of keys in the dictionary is zero.

 o keys
  public abstract IndexIterator keys()
Returns an enumeration of the keys in the dictionary. Note that the enumeration is only guaranteed to be valid for the duration of the current transaction.

 o elements
  public abstract IndexIterator elements()
Returns an enumeration of the elements in the dictionary. Note that the elements are not necessarily unique and that the enumeration is only guaranteed to be valid for the duration of the current transaction.

 o contains
  public abstract boolean contains(Object value)
Checks whether or not the dictionary contains the specified value as an element.

Parameters:
value - The element to search for, which must be nonnull.

Returns:
The true constant if the dictionary contains the specified value. The false constant if it does not.

Throws: NullPointerException
If value is null.
 o containsKey
  public abstract boolean containsKey(Object key)
Checks whether or not the dictionary contains an element with the specified key.

Parameters:
key - The key to search for.

Returns:
The true constant if the dictionary contains an element with the specified key. The false constant if the dictionary does not.

Throws: NullPointerException
If key is null.
 o get
  public abstract Object get(Object key)
Obtains the element mapped at the specified key.

Parameters:
key - The key for the element you want to obtain.

Returns:
The element at the key or null if no such key exists.

Throws: NullPointerException
If key is null.
 o getKey
  public abstract Object getKey(Object key)
Returns the actual key stored for the given key.

Parameters:
key - The key to search for.

Returns:
The actual key stored for the given key, or null if no such key exists.

Throws: NullPointerException
If key is null.
 o put
  public abstract Object put(Object key,
                             Object value)
Enters the mapping of key to value in the dictionary.

Parameters:
key - The key part of the mapping.

value - The value part of the mapping.

Returns:
The object previously mapped at key, or null.

Throws: NullPointerException
If either key or value is null.
 o remove
  public abstract Object remove(Object key)
Removes any existing mapping at the specified key.

Parameters:
key - The key for the mapping you want to remove.

Returns:
The object previously mapped at the specified key, or null.

Throws: NullPointerException
If key is null.
 o clear
  public abstract void clear()
Removes all entries from the dictionary.

 o clearDestroyed
  public abstract void clearDestroyed()
Removes from the hash table all entries which reference destroyed objects either as a key or value.


Copyright © 1996, 1997, 1998 Object Design, Inc. All rights reserved.