com.marringtons.database
Class Index
java.lang.Object
com.marringtons.database.Index
- Direct Known Subclasses:
- Session.PersistentData.index
- public class Index
- extends Object
DAO object interfaces recognise indexes by looking for inner classes that
have extend this base class. Only this and DAO are visible outside the database
package. Names in the Index class must have the same names as fields in
the DAO. You will only need to instantiate an index for a non string/integer or
for an aggregate index to retrieve the first matching record.
static class MyDAO extends DAO
{
int integer; // can contain any form of primative
String string; // and Strings
MyOtherClass myOtherClass; // and any other class you have defined to any depth
HashMap nameValuePairs; // Maps are saved and NVP for more efficient storage
DAO anotherDAO; // normalised - committed and saved as a database pointer only
ArrayList myList; // as are Collections
static class PrimaryIndex extends Index { int integer; String string; }
static class SecondaryIndex extends Index( String string; }
}
...
TestDAO.TertiaryIndex index = new MyDAO.PrimaryIndex();
index.integer = 1962;
index.string = "test string testFirst";
found = (MyDAO) dao.first( index);
- Author:
- Paul Marrington
- See Also:
DAO
|
Constructor Summary |
Index()
|
|
Method Summary |
boolean |
equals(Object to)
Compare to Index objects using the class directory mapping.
|
int |
hashCode()
Generates the hashCode for a known DAO object. |
Index
public Index()
equals
public boolean equals(Object to)
- Compare to Index objects using the class directory mapping.
Used by DAO.java for searches and by in-memory cache of indexes.
- Parameters:
to - compare to.
- Returns:
- try if logically equals.
- See Also:
Object.equals(java.lang.Object)
hashCode
public int hashCode()
- Generates the hashCode for a known DAO object. Does not cache 'cause
user might reload index. Used by DAO.java for searches and by in-memory
cache of indexes.
- Returns:
- hash code.
- See Also:
Object.hashCode()
Copyright © 2004 Paul Marrington http://marringtons.com