|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jcon.data.LookupDatabase
public class LookupDatabase
This is a sort of object database. Object sets are registered with a class and a index for looking things up in that class (for instance, NameIndex looks up things based on their toString() function). This index provides a unique indexing function whose result is used as the index to a Map (hashing the hash, as it were).
When objects are placed in the LookupDatabase, they are placed into the object set whose class is the object's closest ancestor. Once placed in the database, LookupReference objects can be created for the object, to files or passed around or whatever, and then used later to unswizzle data by dereferencing the LookupReference.
All this is simpler than it sounds.
Another function served by the database is that of defining the set of valid values for a given class in a given context. So, if different clients have different sets of valid values for a certain class, you simply create a LookupDatabase for each client, with an object set registered for the class of interest, filled with the valid values for that class.
Dictionaries automagically include object sets for all EnumeratedTypes, so there is no need to register these.
| Constructor Summary | |
|---|---|
LookupDatabase()
Create a new, empty LookupDatabase. |
|
| Method Summary | |
|---|---|
void |
addIndex(java.lang.String className,
LookupIndex index)
Creates an object set by adding a classname/index mapping. |
void |
addIndex(java.lang.String className,
LookupIndex index,
java.util.Set lookupSet)
Creates an object set by adding a classname/index mapping, and supplies the set of objects for that mapping too. |
void |
addObject(java.lang.Object ob)
Adds an object to the database. |
boolean |
contains(java.lang.Object ob)
True if object is in the database, and can therefore be looked up. |
java.lang.Object |
keyOf(java.lang.Object victim)
Returns the lookup key of an object. |
java.lang.Object |
lookup(LookupReference ref)
Dereference a LookupReference. |
java.lang.Object |
lookupObject(java.lang.Class classy,
java.lang.Object parameter)
Looks up an object based on its class and a parameter. |
java.lang.Object |
lookupObject(java.lang.String className,
java.lang.Object parameter)
Look up an object based on its class name and a parameter. |
LookupReference |
referenceFor(java.lang.Object ob)
Returns a LookupReference for an object. |
java.util.Iterator |
validObjectsFor(java.lang.Class classy)
Returns valid object set for a registered class. |
java.util.Iterator |
validObjectsFor(java.lang.String classname)
Returns valid object set for a registered class by class name. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LookupDatabase()
| Method Detail |
|---|
public void addIndex(java.lang.String className,
LookupIndex index)
public void addIndex(java.lang.String className,
LookupIndex index,
java.util.Set lookupSet)
public void addObject(java.lang.Object ob)
public java.util.Iterator validObjectsFor(java.lang.Class classy)
public java.util.Iterator validObjectsFor(java.lang.String classname)
public java.lang.Object lookupObject(java.lang.Class classy,
java.lang.Object parameter)
throws LookupFailedException
LookupFailedException
public java.lang.Object lookupObject(java.lang.String className,
java.lang.Object parameter)
throws LookupFailedException
LookupFailedException
public java.lang.Object lookup(LookupReference ref)
throws LookupFailedException
LookupFailedExceptionpublic java.lang.Object keyOf(java.lang.Object victim)
public boolean contains(java.lang.Object ob)
public LookupReference referenceFor(java.lang.Object ob)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||