org.netbeans.mdr.persistence
Interface SinglevaluedIndex

All Superinterfaces:
Index
All Known Implementing Classes:
BtreeDatabase, SinglevaluedBtree

public interface SinglevaluedIndex
extends Index

Representation index where exactly one value is associated with each key.

Version:
Author:
Pavel Buzek

Method Summary
 java.lang.Object get(java.lang.Object key)
          Returns the value to which this index maps the specified key.
 java.lang.Object getIfExists(java.lang.Object key)
          Returns the value to which this index maps the specified key or null if there is no value for this key.
 java.lang.Object getObject(java.lang.Object key, SinglevaluedIndex repos)
          Like get, but if the index contains keys, this returns the object corresponding to the key
 java.lang.Object getObjectIfExists(java.lang.Object key, SinglevaluedIndex repos)
          Like getIfExists, but if the index contains keys, this returns the object corresponding to the key
 boolean put(java.lang.Object key, java.lang.Object value)
          Associates the specified value with the specified key in this index.
 java.util.Collection queryByKeyPrefix(java.lang.Object prefix, SinglevaluedIndex repos)
          Returns a collection view of Map.Entry key-value pairs in the index, where key matches the queried prefix.
 void replace(java.lang.Object key, java.lang.Object value)
          Replaces the original value associated with the specified key in this index with new value.
 java.util.Collection values()
          Returns a collection view of the values contained in this index.
 
Methods inherited from interface org.netbeans.mdr.persistence.Index
add, getKeyType, getName, getValueType, keySet, remove
 

Method Detail

put

public boolean put(java.lang.Object key,
                   java.lang.Object value)
            throws StorageException
Associates the specified value with the specified key in this index.

Parameters:
key -
value -
Returns:
true if there was an item in this index that was associated with the key prior to this call
Throws:
StorageException

replace

public void replace(java.lang.Object key,
                    java.lang.Object value)
             throws StorageException,
                    StorageBadRequestException
Replaces the original value associated with the specified key in this index with new value. If no value was associated with this key prior to this call StorageBadRequestException is thrown.

Parameters:
key -
value -
Throws:
StorageException
StorageBadRequestException

get

public java.lang.Object get(java.lang.Object key)
                     throws StorageException,
                            StorageBadRequestException
Returns the value to which this index maps the specified key. StorageBadRequestException is thrown if there is no value for the key.

Parameters:
key -
Returns:
value associated with specified key
Throws:
StorageException
StorageBadRequestException

getObject

public java.lang.Object getObject(java.lang.Object key,
                                  SinglevaluedIndex repos)
                           throws StorageException
Like get, but if the index contains keys, this returns the object corresponding to the key

Parameters:
key -
Returns:
Throws:
StorageException

getIfExists

public java.lang.Object getIfExists(java.lang.Object key)
                             throws StorageException
Returns the value to which this index maps the specified key or null if there is no value for this key.

Parameters:
key -
Returns:
value associated with specified key or null
Throws:
StorageException

getObjectIfExists

public java.lang.Object getObjectIfExists(java.lang.Object key,
                                          SinglevaluedIndex repos)
                                   throws StorageException
Like getIfExists, but if the index contains keys, this returns the object corresponding to the key

Parameters:
key -
Returns:
Throws:
StorageException

values

public java.util.Collection values()
                            throws StorageException
Returns a collection view of the values contained in this index. Returned collection is read only and may not be modified. If this index has no items, empty Collection is returned.

Returns:
Throws:
StorageException

queryByKeyPrefix

public java.util.Collection queryByKeyPrefix(java.lang.Object prefix,
                                             SinglevaluedIndex repos)
                                      throws StorageException
Returns a collection view of Map.Entry key-value pairs in the index, where key matches the queried prefix. Values are objects (as returned by getObject method).

Parameters:
prefix - queried prefix
repos - primary index
Returns:
Throws:
StorageException
java.lang.UnsupportedOperationException - thrown if the index does not support quries on prefixes (due to unsuitable key entry type, etc.)


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.