|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hydrateframework.ObjectIndex
public abstract class ObjectIndex
This is the abstract base class for the indexes used to look up objects in the object context. It contains a lookup that uses keys of a particular class to look up one or more objects of another class.
Field Summary | |
---|---|
protected java.lang.Class |
m_cls
The class that this object will be indexing. |
protected ObjectContext |
m_ctx
|
protected java.lang.Class |
m_keyCls
|
Constructor Summary | |
---|---|
protected |
ObjectIndex(java.lang.Class cls)
This constructor builds an index to hold objects of a particular class |
protected |
ObjectIndex(java.lang.Class clsToIndex,
java.lang.Class keyClass)
Create an index object |
Method Summary | |
---|---|
void |
addObject(java.lang.Object obj)
Add an object to this index. |
abstract void |
addObject(java.lang.Object obj,
ObjectKey key)
Add an object to the index with the given key. |
abstract void |
clear()
Clear the index. |
java.io.PrintStream |
dump(java.io.PrintStream out)
Output details of the index to a PrintStream . |
boolean |
equals(java.lang.Object o)
Tests to see if two indexes are the same. |
abstract java.lang.Object |
findObject(ObjectKey key)
This abstract method should be implemented to find an object given a key. |
abstract ObjectCollection |
findObjects(ObjectKey key)
This method should be implemented to find a collection of business objects given a key. |
java.lang.Class |
getClassToIndex()
Gets the class that will be indexed. |
java.lang.Class |
getKeyClass()
Return the key class that is being used in the index |
ObjectKey |
keyFromObject(java.lang.Object obj)
Get a key given a (hydrate) object. |
abstract java.util.Iterator |
keys()
return an iterator that can enumerate the keys held in this index object. |
abstract java.lang.Object |
removeKey(ObjectKey key)
Remove the entire contents of a particular key in this index. |
void |
removeObject(java.lang.Object obj)
Remove an object from the index. |
abstract void |
removeObject(java.lang.Object obj,
ObjectKey key)
Remove an object from the index using the given key. |
protected void |
setObjectContext(ObjectContext ctx)
Establish the object context for a particular index |
abstract int |
size()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.Class m_cls
protected java.lang.Class m_keyCls
protected ObjectContext m_ctx
Constructor Detail |
---|
protected ObjectIndex(java.lang.Class cls)
cls
- the class of object which should be the base interface in
the object heirarchy. For example if you are indexing manager and
staff objects, both derived from employee, use employee for this class.
Note this means that there will be only one primary key index for all
classes in a particular hierarchy.protected ObjectIndex(java.lang.Class clsToIndex, java.lang.Class keyClass)
clsToIndex
- the class that should be indexedkeyClass
- the key class to useMethod Detail |
---|
protected void setObjectContext(ObjectContext ctx)
ctx
- the new owning contextpublic java.lang.Class getClassToIndex()
public java.lang.Class getKeyClass()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the BusObjIndex object against which to test equality
public ObjectKey keyFromObject(java.lang.Object obj)
obj
- The object for which a key is required. This would normally be an HydrateObject
public java.io.PrintStream dump(java.io.PrintStream out)
PrintStream
.
out
- where to send the output
public abstract java.lang.Object findObject(ObjectKey key)
key
- the key to use on the index
public abstract ObjectCollection findObjects(ObjectKey key)
key
- the key to use on the index
public void addObject(java.lang.Object obj)
obj
- the object to add to the indexpublic abstract void addObject(java.lang.Object obj, ObjectKey key)
obj
- the object to add to the indexkey
- the key to use in adding the objectpublic void removeObject(java.lang.Object obj)
obj
- the object to be removed.public abstract void removeObject(java.lang.Object obj, ObjectKey key)
obj
- the object to be removedkey
- the key to be used to find the objectpublic abstract java.lang.Object removeKey(ObjectKey key)
key
- the key to be removed
public abstract java.util.Iterator keys()
ObjectKey
.
public abstract int size()
public abstract void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |