com.ccg.util
Interface LookupKeyed

All Superinterfaces:
Lookup
All Known Implementing Classes:
LookupINI, LookupOrdered, LookupProperties

public interface LookupKeyed
extends Lookup

A Lookup table which can have all of its "keys" retrieved.

A simple Lookup table only allows one to fetch values for a specific key. Sometimes it can be useful to fetch all of the keys which a Lookup table contains. This allows one to iterate over the entire contents of a Lookup table. It should be noted that the "keys" fetched may not be returned in any specific order. Take a look at the LookupOrdered object to see an example of a class which implements this interface and also provides a method to fetch back keys in the order they were first put into the table.

It should be noted that this interface reiterates the methods which it extends from its parent class. This should not have been required, but was done to fix a problem encountered in the Internet Explorer 4.0 JVM.

Since:
1.0
Version:
$Revision: 1.1.1.1 $
Author:
$Author: pkb $
See Also:
LookupCreate

Method Summary
 Object get(Object key)
          Fetch the value associated with a "key" Try to lookup the Object which is associated with the key.
 Enumeration getKeys()
          Get enumeration of all of the keys in the lookup table.
 String getString(Object key)
          Fetch a String "value" associated with a "key".
 

Method Detail

get

Object get(Object key)
Fetch the value associated with a "key" Try to lookup the Object which is associated with the key. This method should never throw an exception (if implemented correctly).

If you are implementing this method in your class, you must be certain that it never invokes the getString(Object) method! Let me repeat: It is permitted for the getString(java.lang.Object) method to invoke this method, but not the other way around! Failure to follow this convention can result in potentially infinite recursion.

Specified by:
get in interface Lookup
Parameters:
key - Key to use to look up object with (if you pass null, you will get null back). If the object passed is non-null, it should not throw any exceptions if the Object.toString() is invoked on it.
Returns:
Object found (if exists) or null if not found.
Since:
1.0
See Also:
LookupCreate

getString

String getString(Object key)
Fetch a String "value" associated with a "key". Try to lookup the String object which is associated with the key. This method should never throw an exception (if implemented correctly). Most implementation will probably just wrap the get(java.lang.Object) method with this method.

Specified by:
getString in interface Lookup
Parameters:
key - Key to use to look up object with (if you pass null, you will get null back). If the object passed is non-null, it should not throw any exceptions if the Object.toString() is invoked on it.
Returns:
Object found (if exists) returned as a String or null if not found. This implies that the objects contained by the Lookup table all support the Object.toString() method without Exception.
Since:
1.0
See Also:
LookupCreate

getKeys

Enumeration getKeys()
Get enumeration of all of the keys in the lookup table.

Returns:
Enumeration list of all keys in the Lookup table.
Since:
1.0


Copyright 1998-1998-2006 null. All Rights Reserved.