org.cruxframework.crux.core.client.db
Class IDXIndex<K,I,V>

java.lang.Object
  extended by org.cruxframework.crux.core.client.db.DBObject
      extended by org.cruxframework.crux.core.client.db.Index<K,I,V>
          extended by org.cruxframework.crux.core.client.db.IDXIndex<K,I,V>
Type Parameters:
K - object key type
I - index key type. The type of the indexed column
V - object type

public abstract class IDXIndex<K,I,V>
extends Index<K,I,V>

CRUX INTERNAL CLASS. DO NOT USE IT DIRECTLY. Indexed DB implementation for Index Interface. Use the interface Index instead.

Author:
Thiago da Rosa de Bustamante, Thiago da Rosa de Bustamante

Field Summary
protected  IDXAbstractDatabase db
           
protected  IDBIndex idbIndex
           
 
Fields inherited from class org.cruxframework.crux.core.client.db.DBObject
logger
 
Constructor Summary
protected IDXIndex(IDXAbstractDatabase db, IDBIndex idbIndex)
           
 
Method Summary
 void count(DatabaseCountCallback callback)
          Return the number of items referenced by the index.
 void count(KeyRange<I> range, DatabaseCountCallback callback)
          Return the number of items referenced by the index in the given range.
abstract  void get(I key, DatabaseRetrieveCallback<V> callback)
          Retrieve the object associated with the given key from the index.
abstract  void get(KeyRange<I> keyRange, DatabaseRetrieveCallback<V> callback)
          Retrieve the object in the given keyRange from the index.
abstract  void getKey(I key, DatabaseRetrieveCallback<K> callback)
          Retrieve the object key associated with the given key from the index.
abstract  void getKey(KeyRange<I> keyRange, DatabaseRetrieveCallback<K> callback)
          Retrieve the object key in the given keyRange from the index.
abstract  KeyRangeFactory<I> getKeyRangeFactory()
          Retrieve a factory to create KeyRange objects used by this index.
 String getName()
          Retrieve the index name
 boolean isMultiEntry()
          This flag affects how the index behaves when the result of evaluating the index's key path yields an Array.
 boolean isUnique()
          Retrieve true if each key inside the index must be unique.
abstract  void openCursor(DatabaseCursorCallback<I,V> callback)
          Open a cursor to iterate over the object store.
abstract  void openCursor(KeyRange<I> keyRange, Cursor.CursorDirection direction, DatabaseCursorCallback<I,V> callback)
          Open a cursor to iterate over the object store.
abstract  void openCursor(KeyRange<I> keyRange, DatabaseCursorCallback<I,V> callback)
          Open a cursor to iterate over the object store.
abstract  void openKeyCursor(DatabaseCursorCallback<I,K> callback)
          Open a cursor to iterate over the object store.
abstract  void openKeyCursor(KeyRange<I> keyRange, Cursor.CursorDirection direction, DatabaseCursorCallback<I,K> callback)
          Open a cursor to iterate over the object store.
abstract  void openKeyCursor(KeyRange<I> keyRange, DatabaseCursorCallback<I,K> callback)
          Open a cursor to iterate over the object store.
 
Methods inherited from class org.cruxframework.crux.core.client.db.DBObject
reportError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

idbIndex

protected final IDBIndex idbIndex

db

protected final IDXAbstractDatabase db
Constructor Detail

IDXIndex

protected IDXIndex(IDXAbstractDatabase db,
                   IDBIndex idbIndex)
Method Detail

getName

public String getName()
Retrieve the index name

Specified by:
getName in class Index<K,I,V>
Returns:

isUnique

public boolean isUnique()
Description copied from class: Index
Retrieve true if each key inside the index must be unique. If an unique index exists for an object store, any add or put operation that violates this index constraints will fail.

Specified by:
isUnique in class Index<K,I,V>
Returns:
true if index is unique

isMultiEntry

public boolean isMultiEntry()
Description copied from class: Index
This flag affects how the index behaves when the result of evaluating the index's key path yields an Array. If the multiEntry flag is false, then a single record whose key is an Array is added to the index. If the multiEntry flag is true, then the one record is added to the index for each item in the Array.

Specified by:
isMultiEntry in class Index<K,I,V>
Returns:
true if this is a multi entry index.

count

public void count(DatabaseCountCallback callback)
Return the number of items referenced by the index.

Specified by:
count in class Index<K,I,V>
Parameters:
callback -

count

public void count(KeyRange<I> range,
                  DatabaseCountCallback callback)
Return the number of items referenced by the index in the given range.

Specified by:
count in class Index<K,I,V>
Parameters:
range -
callback -

get

public abstract void get(I key,
                         DatabaseRetrieveCallback<V> callback)
Retrieve the object associated with the given key from the index. To read the object, use the method onSuccess from DatabaseRetrieveCallback.

Specified by:
get in class Index<K,I,V>
Parameters:
key -
callback -

get

public abstract void get(KeyRange<I> keyRange,
                         DatabaseRetrieveCallback<V> callback)
Retrieve the object in the given keyRange from the index. To read the object, use the method onSuccess from DatabaseRetrieveCallback.

Specified by:
get in class Index<K,I,V>
Parameters:
keyRange -
callback -

getKey

public abstract void getKey(I key,
                            DatabaseRetrieveCallback<K> callback)
Retrieve the object key associated with the given key from the index. To read the object, use the method onSuccess from DatabaseRetrieveCallback.

Specified by:
getKey in class Index<K,I,V>
Parameters:
key -
callback -

getKey

public abstract void getKey(KeyRange<I> keyRange,
                            DatabaseRetrieveCallback<K> callback)
Retrieve the object key in the given keyRange from the index. To read the object, use the method onSuccess from DatabaseRetrieveCallback.

Specified by:
getKey in class Index<K,I,V>
Parameters:
keyRange -
callback -

openCursor

public abstract void openCursor(DatabaseCursorCallback<I,V> callback)
Open a cursor to iterate over the object store.

Specified by:
openCursor in class Index<K,I,V>
Parameters:
callback -

openCursor

public abstract void openCursor(KeyRange<I> keyRange,
                                DatabaseCursorCallback<I,V> callback)
Open a cursor to iterate over the object store.

Specified by:
openCursor in class Index<K,I,V>
Parameters:
keyRange -
callback -

openCursor

public abstract void openCursor(KeyRange<I> keyRange,
                                Cursor.CursorDirection direction,
                                DatabaseCursorCallback<I,V> callback)
Open a cursor to iterate over the object store.

Specified by:
openCursor in class Index<K,I,V>
Parameters:
keyRange -
direction -
callback -

openKeyCursor

public abstract void openKeyCursor(DatabaseCursorCallback<I,K> callback)
Open a cursor to iterate over the object store.

Specified by:
openKeyCursor in class Index<K,I,V>
Parameters:
callback -

openKeyCursor

public abstract void openKeyCursor(KeyRange<I> keyRange,
                                   DatabaseCursorCallback<I,K> callback)
Open a cursor to iterate over the object store.

Specified by:
openKeyCursor in class Index<K,I,V>
Parameters:
keyRange -
callback -

openKeyCursor

public abstract void openKeyCursor(KeyRange<I> keyRange,
                                   Cursor.CursorDirection direction,
                                   DatabaseCursorCallback<I,K> callback)
Open a cursor to iterate over the object store.

Specified by:
openKeyCursor in class Index<K,I,V>
Parameters:
keyRange -
direction -
callback -

getKeyRangeFactory

public abstract KeyRangeFactory<I> getKeyRangeFactory()
Retrieve a factory to create KeyRange objects used by this index.

Specified by:
getKeyRangeFactory in class Index<K,I,V>
Returns:


Copyright © 2014. All rights reserved.