Module spring.data.keyvalue
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
ConstructorsModifierConstructorDescriptionprotectedCreates newAbstractKeyValueAdapterwith using the default query engine.protectedAbstractKeyValueAdapter(QueryEngine<? extends KeyValueAdapter, ?, ?> engine) Creates newAbstractKeyValueAdapterwith using the default query engine.protectedAbstractKeyValueAdapter(SortAccessor<Comparator<?>> sortAccessor) Creates newAbstractKeyValueAdapterwith using the default query engine and provided comparator for sorting. -
Method Summary
Modifier and TypeMethodDescriptionlongcount(KeyValueQuery<?> query, String keyspace) Count all matching objects within keyspace.<T> TDelete 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> TGet the object with given id from keyspace.protected QueryEngine<? extends KeyValueAdapter,?, ?> Get theQueryEngineused.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.DisposableBean
destroy
-
Constructor Details
-
AbstractKeyValueAdapter
protected AbstractKeyValueAdapter()Creates newAbstractKeyValueAdapterwith using the default query engine. -
AbstractKeyValueAdapter
Creates newAbstractKeyValueAdapterwith using the default query engine and provided comparator for sorting.- Parameters:
sortAccessor- must not be null.- Since:
- 3.1.10
-
AbstractKeyValueAdapter
Creates newAbstractKeyValueAdapterwith using the default query engine.- Parameters:
engine- will be defaulted toSpelQueryEngineif null.
-
-
Method Details
-
getQueryEngine
Get theQueryEngineused.- Returns:
-
get
Description copied from interface:KeyValueAdapterGet the object with given id from keyspace.- Specified by:
getin 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:KeyValueAdapterDelete and return the object with given type and id.- Specified by:
deletein 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:
findin interfaceKeyValueAdapter- Parameters:
query- must not be null.keyspace- must not be null.type- must not be null.- Returns:
- empty
Collectionif no match found.
-
find
Description copied from interface:KeyValueAdapterFind all matching objects within keyspace.- Specified by:
findin interfaceKeyValueAdapter- Parameters:
query- must not be null.keyspace- must not be null.- Returns:
- empty
Collectionif no match found.
-
count
Description copied from interface:KeyValueAdapterCount all matching objects within keyspace.- Specified by:
countin interfaceKeyValueAdapter- Parameters:
query- must not be null.keyspace- must not be null.- Returns:
-