|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Lookup
Generic "fetch" interface.
Seems like I'm always using things that are collections of objects
which have a lookup by key function (things like java.util.Hashtable,
java.util.Properties, java.applet.Applet, CommandLine as
some examples). This interface is provided to allow one to create a
wrapper around these types of objects to provide a standard lookup
object.
If you design methods which accept a Lookup object, you
will gain a lot of flexibility in your methods.
LookupCreate,
CommandLine| Method Summary | |
|---|---|
Object |
get(Object key)
Fetch the value associated with a "key" Try to lookup the Object which is associated with the key. |
String |
getString(Object key)
Fetch a String "value" associated with a "key". |
| Method Detail |
|---|
Object get(Object key)
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.
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.
LookupCreateString getString(Object key)
get(java.lang.Object) method with this method.
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.
Lookup table all support the Object.toString() method
without Exception.LookupCreate
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||