V
- the object type of values to be serialized into the collectionpublic interface BlueCollection<V extends java.io.Serializable>
Modifier and Type | Method and Description |
---|---|
void |
batchDelete(java.util.Collection<BlueKey> keys)
Deletes the values for the given keys.
|
void |
batchUpsert(java.util.Map<BlueKey,V> values)
Inserts or replaces the given key value pairs.
|
boolean |
contains(BlueKey key)
Returns true if the collection contains a value for the given key.
|
<K extends ValueKey> |
createIndex(java.lang.String name,
java.lang.Class<K> keyType,
KeyExtractor<K,V> keyExtractor)
|
void |
delete(BlueKey key)
Deletes the value for the given key
|
V |
get(BlueKey key)
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key
|
<K extends ValueKey> |
getIndex(java.lang.String name,
java.lang.Class<K> keyType)
Returns existing BlueIndex that maps objects of type keyType to values in the collection.
|
BlueKey |
getLastKey()
Returns the key with the highest grouping number that exists in this collection
|
void |
insert(BlueKey key,
V value)
Inserts the given key value pair
|
BlueQuery<V> |
query()
Creates a
BlueQuery object which can be used to build and execute a query against this collection. |
void |
replace(BlueKey key,
Mapper<V> updater)
Replaces the value for the given key by passing it to the given updater
|
void |
update(BlueKey key,
Updater<V> updater)
Mutates the value for the given key by passing it to the given updater
|
<K extends ValueKey> BlueIndex<K,V> createIndex(java.lang.String name, java.lang.Class<K> keyType, KeyExtractor<K,V> keyExtractor) throws BlueDbException
BlueIndex
that maps objects of type ValueKey
(UUIDKey
, StringKey
, IntegerKey
, LongKey
) to values in the collection.K
- the key type of the index or the type of data that the collection is being indexed on. It must be a concretion of
ValueKey
(UUIDKey
, StringKey
, LongKey
, or IntegerKey
).name
- index name (one index per name per each collection)keyType
- the type of each key which is used to lookup a value using the index (this must match the keyType of any existing index with the same name)keyExtractor
- a function that maps a value to the keys by which the value should be indexed. The appropriate subclass can be used and would be more
simple to implement. These include UUIDIndexKeyExtractor
, StringIndexKeyExtractor
, IntegerIndexKeyExtractor
, and LongIndexKeyExtractor
BlueIndex
object (existing index if it exists, otherwise a newly created index)BlueDbException
- if the index exists but is not compatible with these types<K extends ValueKey> BlueIndex<K,V> getIndex(java.lang.String name, java.lang.Class<K> keyType) throws BlueDbException
K
- the key type of the index or the type of data that the collection is being indexed on. It must be a concretion of
ValueKey
(UUIDKey
, StringKey
, LongKey
, or IntegerKey
).name
- index name (one index per name per each collection)keyType
- the type of each key which is used to lookup a value using the index (this must match the keyType of any existing index with the same name)BlueIndex
with the same name if it exists and has the same keyTypeBlueDbException
- if index doesn't exist or has a different keyTypeboolean contains(BlueKey key) throws BlueDbException
key
- the key that may or may not be in collectionBlueDbException
- if the type of key was not the type specified when the collection was createdvoid insert(BlueKey key, V value) throws BlueDbException
key
- key where value should be saved (must match the keyType specified when the collection was created)value
- value to be saved for the keyBlueDbException
- if the key type is not the type specified when the collection was createdvoid batchUpsert(java.util.Map<BlueKey,V> values) throws BlueDbException
values
- the key value pairs to insert. Key types must match the keyType specified when the collection was created.BlueDbException
- if the key types do not match the type specified when the collection was createdV get(BlueKey key) throws BlueDbException
key
- the key for the desired valueBlueDbException
- if the key is not the same type specified when the collection was createdvoid update(BlueKey key, Updater<V> updater) throws BlueDbException
key
- The key for the value which will be updatedupdater
- a function that mutates the value to which the specified key is mappedBlueDbException
- if type of key is not the type specified when the collection was created or if updater throws an exceptionvoid replace(BlueKey key, Mapper<V> updater) throws BlueDbException
key
- the key for the value which will be replacedupdater
- a function that returns the value that should replace the value to which the specified key is mappedBlueDbException
- if type of key is not the type specified when the collection was created or if updater throws an exceptionvoid delete(BlueKey key) throws BlueDbException
key
- the key for the value which will be deletedBlueDbException
- if type of key is not the type specified when the collection was createdvoid batchDelete(java.util.Collection<BlueKey> keys) throws BlueDbException
keys
- the keys for the values which will be deletedBlueDbException
- if type of key is not the type specified when the collection was createdBlueQuery<V> query()
BlueQuery
object which can be used to build and execute a query against this collection.BlueQuery
object which can be used to build and execute a query against this collection.BlueKey getLastKey()