abstract class BasicIndex<K,E> extends java.lang.Object implements EntityIndex<K,E>
| Modifier and Type | Field and Description |
|---|---|
(package private) Database |
db |
(package private) KeyRange |
emptyRange |
(package private) ValueAdapter<E> |
entityAdapter |
(package private) ValueAdapter<K> |
keyAdapter |
(package private) EntryBinding |
keyBinding |
(package private) java.lang.Class<K> |
keyClass |
(package private) boolean |
locking |
(package private) static DatabaseEntry |
NO_RETURN_ENTRY |
(package private) boolean |
sortedDups |
(package private) boolean |
transactional |
| Constructor and Description |
|---|
BasicIndex(Database db,
java.lang.Class<K> keyClass,
EntryBinding keyBinding,
ValueAdapter<E> entityAdapter) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(K key)
Checks for existence of a key in this index.
|
boolean |
contains(Transaction txn,
K key,
LockMode lockMode)
Checks for existence of a key in this index.
|
long |
count()
Returns a non-transactional count of the entities in this index.
|
boolean |
delete(K key)
Deletes all entities with a given index key.
|
boolean |
delete(Transaction txn,
K key)
Deletes all entities with a given index key.
|
EntityCursor<E> |
entities()
Opens a cursor for traversing all entities in this index.
|
EntityCursor<E> |
entities(K fromKey,
boolean fromInclusive,
K toKey,
boolean toInclusive)
Opens a cursor for traversing entities in a key range.
|
EntityCursor<E> |
entities(Transaction txn,
CursorConfig config)
Opens a cursor for traversing all entities in this index.
|
EntityCursor<E> |
entities(Transaction txn,
K fromKey,
boolean fromInclusive,
K toKey,
boolean toInclusive,
CursorConfig config)
Opens a cursor for traversing entities in a key range.
|
(package private) abstract boolean |
isUpdateAllowed() |
EntityCursor<K> |
keys()
Opens a cursor for traversing all keys in this index.
|
EntityCursor<K> |
keys(K fromKey,
boolean fromInclusive,
K toKey,
boolean toInclusive)
Opens a cursor for traversing keys in a key range.
|
EntityCursor<K> |
keys(Transaction txn,
CursorConfig config)
Opens a cursor for traversing all keys in this index.
|
EntityCursor<K> |
keys(Transaction txn,
K fromKey,
boolean fromInclusive,
K toKey,
boolean toInclusive,
CursorConfig config)
Opens a cursor for traversing keys in a key range.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitget, get, map, sortedMapstatic final DatabaseEntry NO_RETURN_ENTRY
Database db
boolean transactional
boolean sortedDups
boolean locking
java.lang.Class<K> keyClass
EntryBinding keyBinding
KeyRange emptyRange
ValueAdapter<K> keyAdapter
ValueAdapter<E> entityAdapter
BasicIndex(Database db, java.lang.Class<K> keyClass, EntryBinding keyBinding, ValueAdapter<E> entityAdapter) throws DatabaseException
DatabaseExceptionpublic boolean contains(K key) throws DatabaseException
EntityIndexThe operation will not be transaction protected, and LockMode.DEFAULT is used implicitly.
contains in interface EntityIndex<K,E>key - the key to search for.DatabaseExceptionpublic boolean contains(Transaction txn, K key, LockMode lockMode) throws DatabaseException
EntityIndexcontains in interface EntityIndex<K,E>txn - the transaction used to protect this operation, or null
if the operation should not be transaction protected.key - the key to search for.lockMode - the lock mode to use for this operation, or null to
use LockMode.DEFAULT.DatabaseExceptionpublic long count()
throws DatabaseException
EntityIndexThis operation is faster than obtaining a count by scanning the index manually, and will not perturb the current contents of the cache. However, the count is not guaranteed to be accurate if there are concurrent updates.
count in interface EntityIndex<K,E>DatabaseExceptionpublic boolean delete(K key) throws DatabaseException
EntityIndexAuto-commit is used implicitly if the store is transactional.
delete in interface EntityIndex<K,E>key - the key to search for.DatabaseExceptionpublic boolean delete(Transaction txn, K key) throws DatabaseException
EntityIndexdelete in interface EntityIndex<K,E>txn - the transaction used to protect this operation, null to use
auto-commit, or null if the store is non-transactional.key - the key to search for.DatabaseExceptionpublic EntityCursor<K> keys() throws DatabaseException
EntityIndexThe operations performed with the cursor will not be transaction
protected, and CursorConfig.DEFAULT is used implicitly. If the
store is transactional, the cursor may not be used to update or delete
entities.
keys in interface EntityIndex<K,E>DatabaseExceptionpublic EntityCursor<K> keys(Transaction txn, CursorConfig config) throws DatabaseException
EntityIndexkeys in interface EntityIndex<K,E>txn - the transaction used to protect all operations performed with
the cursor, or null if the operations should not be transaction
protected. If null is specified and the store is transactional, the
cursor may not be used to update or delete entities.config - the cursor configuration that determines the default lock
mode used for all cursor operations, or null to implicitly use CursorConfig.DEFAULT.DatabaseExceptionpublic EntityCursor<E> entities() throws DatabaseException
EntityIndexThe operations performed with the cursor will not be transaction
protected, and CursorConfig.DEFAULT is used implicitly. If the
store is transactional, the cursor may not be used to update or delete
entities.
entities in interface EntityIndex<K,E>DatabaseExceptionpublic EntityCursor<E> entities(Transaction txn, CursorConfig config) throws DatabaseException
EntityIndexentities in interface EntityIndex<K,E>txn - the transaction used to protect all operations performed with
the cursor, or null if the operations should not be transaction
protected. If null is specified and the store is transactional, the
cursor may not be used to update or delete entities.config - the cursor configuration that determines the default lock
mode used for all cursor operations, or null to implicitly use CursorConfig.DEFAULT.DatabaseExceptionpublic EntityCursor<K> keys(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) throws DatabaseException
EntityIndexThe operations performed with the cursor will not be transaction
protected, and CursorConfig.DEFAULT is used implicitly. If the
store is transactional, the cursor may not be used to update or delete
entities.
keys in interface EntityIndex<K,E>fromKey - is the lower bound of the key range, or null if the range
has no lower bound.fromInclusive - is true if keys greater than or equal to fromKey
should be included in the key range, or false if only keys greater than
fromKey should be included.toKey - is the upper bound of the key range, or null if the range
has no upper bound.toInclusive - is true if keys less than or equal to toKey should be
included in the key range, or false if only keys less than toKey should
be included.DatabaseExceptionpublic EntityCursor<K> keys(Transaction txn, K fromKey, boolean fromInclusive, K toKey, boolean toInclusive, CursorConfig config) throws DatabaseException
EntityIndexkeys in interface EntityIndex<K,E>txn - the transaction used to protect all operations performed with
the cursor, or null if the operations should not be transaction
protected. If null is specified and the store is transactional, the
cursor may not be used to update or delete entities.fromKey - is the lower bound of the key range, or null if the range
has no lower bound.fromInclusive - is true if keys greater than or equal to fromKey
should be included in the key range, or false if only keys greater than
fromKey should be included.toKey - is the upper bound of the key range, or null if the range
has no upper bound.toInclusive - is true if keys less than or equal to toKey should be
included in the key range, or false if only keys less than toKey should
be included.config - the cursor configuration that determines the default lock
mode used for all cursor operations, or null to implicitly use CursorConfig.DEFAULT.DatabaseExceptionpublic EntityCursor<E> entities(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) throws DatabaseException
EntityIndexThe operations performed with the cursor will not be transaction
protected, and CursorConfig.DEFAULT is used implicitly. If the
store is transactional, the cursor may not be used to update or delete
entities.
entities in interface EntityIndex<K,E>fromKey - is the lower bound of the key range, or null if the range
has no lower bound.fromInclusive - is true if keys greater than or equal to fromKey
should be included in the key range, or false if only keys greater than
fromKey should be included.toKey - is the upper bound of the key range, or null if the range
has no upper bound.toInclusive - is true if keys less than or equal to toKey should be
included in the key range, or false if only keys less than toKey should
be included.DatabaseExceptionpublic EntityCursor<E> entities(Transaction txn, K fromKey, boolean fromInclusive, K toKey, boolean toInclusive, CursorConfig config) throws DatabaseException
EntityIndexentities in interface EntityIndex<K,E>txn - the transaction used to protect all operations performed with
the cursor, or null if the operations should not be transaction
protected. If null is specified and the store is transactional, the
cursor may not be used to update or delete entities.fromKey - is the lower bound of the key range, or null if the range
has no lower bound.fromInclusive - is true if keys greater than or equal to fromKey
should be included in the key range, or false if only keys greater than
fromKey should be included.toKey - is the upper bound of the key range, or null if the range
has no upper bound.toInclusive - is true if keys less than or equal to toKey should be
included in the key range, or false if only keys less than toKey should
be included.config - the cursor configuration that determines the default lock
mode used for all cursor operations, or null to implicitly use CursorConfig.DEFAULT.DatabaseExceptionabstract boolean isUpdateAllowed()
Copyright (c) 2004,2008 Oracle. All rights reserved.