Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB version 4.2.52
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sleepycat.bdb
Class DataIndex

    java.lang.Object
      |
      +--com.sleepycat.bdb.DataIndex

Direct Known Subclasses:
  ForeignKeyIndex

public class DataIndex
extends Object

Represents a Berkeley DB secondary index. An index is always attached to a single `DataStore` when it is constructed. An index is typically accessed by passing it to the constructor of one of the collection classes in the com.sleepycat.bdb.collection package. For example:

     Db db = new Db(env, 0);
     db.setFlags(Db.DB_DUPSORT);
     db.open(null, "index.db", null, Db.DB_BTREE, dbOpenFlags, 0);
     DataIndex index = new DataIndex(store, db, keyFormat, keyExtractor);
     StoredMap map = new StoredMap(index, keyBinding, valueBinding, writeAllowed);

All access methods may be used with BDB. However, some access methods may only be used with certain types of collection views, and some access methods impose restrictions on the way collection views are used.

Constructor Summary
`DataIndex(DataStore store, Db db, DataFormat keyFormat, KeyExtractor keyExtractor)` Creates an index from a previously opened Db object.

Method Summary
`KeyExtractor` | `getKeyExtractor()` Returns the key extractor associated with this index.
`DataFormat` | `getKeyFormat()` Returns the key format associated with this index.
`DataStore` | `getStore()` Returns the store associated with this index.
`String` | `toString()` Returns a printable string identifying the file and database name of the index.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### DataIndex

    public DataIndex(DataStore store,
                     Db db,
                     DataFormat keyFormat,
                     KeyExtractor keyExtractor)

  Creates an index from a previously opened Db object.

Parameters:
  `store` - the store to be indexed and also specifies the environment that was used to create the Db object.
  `db` - the previously opened Db object.
  `keyFormat` - the data format for keys.
  `keyExtractor` - an object for extracting the index key from primary key and/or value buffers, and for clearing the index key in a value buffer.
Throws:
  `IllegalArgumentException` - if a format mismatch is detected between the index and the store, or if unsorted duplicates were specified for the index Db.

Method Detail

### getStore

    public final DataStore getStore()

  Returns the store associated with this index.

### getKeyFormat

    public final DataFormat getKeyFormat()

  Returns the key format associated with this index.

### getKeyExtractor

    public final KeyExtractor getKeyExtractor()

  Returns the key extractor associated with this index.

### toString

    public String toString()

  Returns a printable string identifying the file and database name of the index.

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB version 4.2.52
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.