com.sleepycat.persist
Class KeysIndex<SK,PK>

java.lang.Object
  extended by com.sleepycat.persist.BasicIndex<SK,PK>
      extended by com.sleepycat.persist.KeysIndex<SK,PK>
All Implemented Interfaces:
EntityIndex<SK,PK>

 class KeysIndex<SK,PK>
extends BasicIndex<SK,PK>

The EntityIndex returned by SecondaryIndex.keysIndex(). This index maps secondary key to primary key. In Berkeley DB internal terms, this is a secondary database that is opened without associating it with a primary.

Author:
Mark Hayes

Field Summary
 
Fields inherited from class com.sleepycat.persist.BasicIndex
db, emptyRange, entityAdapter, keyAdapter, keyBinding, keyClass, NO_RETURN_ENTRY, transactional
 
Constructor Summary
KeysIndex(Database db, Class<SK> keyClass, EntryBinding keyBinding, Class<PK> pkeyClass, EntryBinding pkeyBinding)
           
 
Method Summary
 PK get(SK key)
          Gets an entity via a key of this index.
 PK get(Transaction txn, SK key, LockMode lockMode)
          Gets an entity via a key of this index.
 Map<SK,PK> map()
          Returns a standard Java map based on this entity index.
 SortedMap<SK,PK> sortedMap()
          Returns a standard Java sorted map based on this entity index.
 
Methods inherited from class com.sleepycat.persist.BasicIndex
contains, contains, count, delete, delete, entities, entities, entities, entities, keys, keys, keys, keys
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeysIndex

KeysIndex(Database db,
          Class<SK> keyClass,
          EntryBinding keyBinding,
          Class<PK> pkeyClass,
          EntryBinding pkeyBinding)
    throws DatabaseException
Throws:
DatabaseException
Method Detail

get

public PK get(SK key)
       throws DatabaseException
Description copied from interface: EntityIndex
Gets an entity via a key of this index.

The operation will not be transaction protected, and LockMode.DEFAULT is used implicitly.

Parameters:
key - the key to search for.
Returns:
the value mapped to the given key, or null if the key is not present in the index.
Throws:
DatabaseException

get

public PK get(Transaction txn,
              SK key,
              LockMode lockMode)
       throws DatabaseException
Description copied from interface: EntityIndex
Gets an entity via a key of this index.

Parameters:
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.
Returns:
the value mapped to the given key, or null if the key is not present in the index.
Throws:
DatabaseException

map

public Map<SK,PK> map()
Description copied from interface: EntityIndex
Returns a standard Java map based on this entity index. The StoredMap returned is defined by the Collections API. Stored collections conform to the standard Java collections framework interface.

Returns:
the map.

sortedMap

public SortedMap<SK,PK> sortedMap()
Description copied from interface: EntityIndex
Returns a standard Java sorted map based on this entity index. The StoredSortedMap returned is defined by the Collections API. Stored collections conform to the standard Java collections framework interface.

Returns:
the map.


Copyright 2004,2008 Oracle. All rights reserved.