Class AbstractKeyValueAdapter
java.lang.Object
org.springframework.data.keyvalue.core.AbstractKeyValueAdapter
- All Implemented Interfaces:
DisposableBean
,KeyValueAdapter
- Direct Known Subclasses:
MapKeyValueAdapter
Base implementation of
KeyValueAdapter
holds QueryEngine
to delegate find and
count execution to.- Author:
- Christoph Strobl, Mark Paluch
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Creates newAbstractKeyValueAdapter
with using the default query engine.protected
AbstractKeyValueAdapter
(QueryEngine<? extends KeyValueAdapter, ?, ?> engine) Creates newAbstractKeyValueAdapter
with using the default query engine.protected
AbstractKeyValueAdapter
(SortAccessor<Comparator<?>> sortAccessor) Creates newAbstractKeyValueAdapter
with using the default query engine and provided comparator for sorting. -
Method Summary
Modifier and TypeMethodDescriptionlong
count
(KeyValueQuery<?> query, String keyspace) Count all matching objects within keyspace.<T> T
Delete and return the object with given type and id.Collection<?>
find
(KeyValueQuery<?> query, String keyspace) Find all matching objects within keyspace.<T> Iterable<T>
find
(KeyValueQuery<?> query, String keyspace, Class<T> type) <T> T
Get the object with given id from keyspace.protected QueryEngine<? extends KeyValueAdapter,
?, ?> Get theQueryEngine
used.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.DisposableBean
destroy
-
Constructor Details
-
AbstractKeyValueAdapter
protected AbstractKeyValueAdapter()Creates newAbstractKeyValueAdapter
with using the default query engine. -
AbstractKeyValueAdapter
Creates newAbstractKeyValueAdapter
with using the default query engine and provided comparator for sorting.- Parameters:
sortAccessor
- must not be null.- Since:
- 3.1.10
-
AbstractKeyValueAdapter
Creates newAbstractKeyValueAdapter
with using the default query engine.- Parameters:
engine
- will be defaulted toSpelQueryEngine
if null.
-
-
Method Details
-
getQueryEngine
Get theQueryEngine
used.- Returns:
-
get
Description copied from interface:KeyValueAdapter
Get the object with given id from keyspace.- Specified by:
get
in interfaceKeyValueAdapter
- Parameters:
id
- must not be null.keyspace
- must not be null.type
- must not be null.- Returns:
- null in case no matching item exists.
-
delete
Description copied from interface:KeyValueAdapter
Delete and return the object with given type and id.- Specified by:
delete
in interfaceKeyValueAdapter
- Parameters:
id
- must not be null.keyspace
- must not be null.type
- must not be null.- Returns:
- null if object could not be found
-
find
- Specified by:
find
in interfaceKeyValueAdapter
- Parameters:
query
- must not be null.keyspace
- must not be null.type
- must not be null.- Returns:
- empty
Collection
if no match found.
-
find
Description copied from interface:KeyValueAdapter
Find all matching objects within keyspace.- Specified by:
find
in interfaceKeyValueAdapter
- Parameters:
query
- must not be null.keyspace
- must not be null.- Returns:
- empty
Collection
if no match found.
-
count
Description copied from interface:KeyValueAdapter
Count all matching objects within keyspace.- Specified by:
count
in interfaceKeyValueAdapter
- Parameters:
query
- must not be null.keyspace
- must not be null.- Returns:
-