Module spring.data.keyvalue
Interface KeyValueAdapter
- All Superinterfaces:
DisposableBean
- All Known Implementing Classes:
AbstractKeyValueAdapter,MapKeyValueAdapter
KeyValueAdapter unifies access and shields the underlying key/value specific implementation.- Author:
- Christoph Strobl, Thomas Darimont, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all objects.booleanCheck if a object with given id exists in keyspace.longCount number of objects within keyspace.longcount(KeyValueQuery<?> query, String keyspace) Count all matching objects within keyspace.Delete and return the object with given type and id.<T> TDelete and return the object with given type and id.voiddeleteAllOf(String keyspace) Remove all objects of given type.Returns aCloseableIteratorthat iterates over all entries.default <T> CloseableIterator<Map.Entry<Object,T>> Returns aCloseableIteratorthat iterates over all entries.default booleanexists(KeyValueQuery<?> query, String keyspace) Determine whether result of givenKeyValueQuerywithin keyspace contains at least one element.default Iterable<?>find(KeyValueQuery<?> query, String keyspace) Find all matching objects within keyspace.<T> Iterable<T>find(KeyValueQuery<?> query, String keyspace, Class<T> type) Get the object with given id from keyspace.<T> TGet the object with given id from keyspace.Iterable<?>Get all elements for given keyspace.default <T> Iterable<T>Get all elements for given keyspace.Add object with given id to keyspace.Methods inherited from interface org.springframework.beans.factory.DisposableBean
destroy
-
Method Details
-
put
Add object with given id to keyspace.- Parameters:
id- must not be null.keyspace- must not be null.- Returns:
- the item previously associated with the id.
-
contains
Check if a object with given id exists in keyspace.- Parameters:
id- must not be null.keyspace- must not be null.- Returns:
- true if item of type with id exists.
-
get
Get the object with given id from keyspace.- Parameters:
id- must not be null.keyspace- must not be null.- Returns:
- null in case no matching item exists.
-
get
Get the object with given id from keyspace.- Parameters:
id- must not be null.keyspace- must not be null.type- must not be null.- Returns:
- null in case no matching item exists.
- Since:
- 1.1
-
delete
Delete and return the object with given type and id.- Parameters:
id- must not be null.keyspace- must not be null.- Returns:
- null if object could not be found
-
delete
Delete and return the object with given type and id.- Parameters:
id- must not be null.keyspace- must not be null.type- must not be null.- Returns:
- null if object could not be found
- Since:
- 1.1
-
getAllOf
Get all elements for given keyspace.- Parameters:
keyspace- must not be null.- Returns:
- empty
Collectionif nothing found.
-
getAllOf
Get all elements for given keyspace.- Parameters:
keyspace- must not be null.type- must not be null.- Returns:
- empty
Collectionif nothing found. - Since:
- 2.5
-
entries
Returns aCloseableIteratorthat iterates over all entries.- Parameters:
keyspace- must not be null.- Returns:
-
entries
Returns aCloseableIteratorthat iterates over all entries.- Parameters:
keyspace- must not be null.type- must not be null.- Returns:
- Since:
- 2.5
-
deleteAllOf
Remove all objects of given type.- Parameters:
keyspace- must not be null.
-
clear
void clear()Removes all objects. -
find
Find all matching objects within keyspace.- Parameters:
query- must not be null.keyspace- must not be null.- Returns:
- empty
Collectionif no match found.
-
find
- Parameters:
query- must not be null.keyspace- must not be null.type- must not be null.- Returns:
- empty
Collectionif no match found. - Since:
- 1.1
-
count
Count number of objects within keyspace.- Parameters:
keyspace- must not be null.- Returns:
-
count
Count all matching objects within keyspace.- Parameters:
query- must not be null.keyspace- must not be null.- Returns:
-
exists
Determine whether result of givenKeyValueQuerywithin keyspace contains at least one element.- Parameters:
query- must not be null.keyspace- must not be null.- Returns:
- Since:
- 2.7
-