Class MapKeyValueAdapter
java.lang.Object
org.springframework.data.keyvalue.core.AbstractKeyValueAdapter
org.springframework.data.map.MapKeyValueAdapter
- All Implemented Interfaces:
DisposableBean,KeyValueAdapter
KeyValueAdapter implementation for Map.- Author:
- Christoph Strobl, Derek Cochran, Marcel Overdijk
-
Constructor Summary
ConstructorsConstructorDescriptionCreate newMapKeyValueAdapterusingConcurrentHashMapas backing store type.MapKeyValueAdapter(Class<? extends Map> mapType) Creates a newMapKeyValueAdapterusing the givenMapas backing store.MapKeyValueAdapter(Class<? extends Map> mapType, QueryEngine<? extends KeyValueAdapter, ?, ?> engine) Creates a newMapKeyValueAdapterusing the givenMapas backing store and query engine.MapKeyValueAdapter(Class<? extends Map> mapType, SortAccessor<Comparator<?>> sortAccessor) Creates a newMapKeyValueAdapterusing the givenMapas backing store.Create new instance ofMapKeyValueAdapterusing given dataStore for persistence.MapKeyValueAdapter(Map<String, Map<Object, Object>> store, QueryEngine<? extends KeyValueAdapter, ?, ?> engine) Create new instance ofMapKeyValueAdapterusing given dataStore for persistence and query engine.MapKeyValueAdapter(QueryEngine<? extends KeyValueAdapter, ?, ?> engine) Create newMapKeyValueAdapterusing the given query engine. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all objects.booleanCheck if a object with given id exists in keyspace.longCount number of objects within keyspace.@Nullable ObjectDelete and return the object with given type and id.voiddeleteAllOf(String keyspace) Remove all objects of given type.voiddestroy()Returns aCloseableIteratorthat iterates over all entries.@Nullable ObjectGet the object with given id from keyspace.Get all elements for given keyspace.getKeySpaceMap(String keyspace) Get map associated with given key space.@Nullable ObjectAdd object with given id to keyspace.Methods inherited from class org.springframework.data.keyvalue.core.AbstractKeyValueAdapter
count, delete, find, find, get, getQueryEngineMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.keyvalue.core.KeyValueAdapter
entries, exists, getAllOf
-
Constructor Details
-
MapKeyValueAdapter
public MapKeyValueAdapter()Create newMapKeyValueAdapterusingConcurrentHashMapas backing store type. -
MapKeyValueAdapter
Create newMapKeyValueAdapterusing the given query engine.- Parameters:
engine- the query engine.- Since:
- 2.4
-
MapKeyValueAdapter
Creates a newMapKeyValueAdapterusing the givenMapas backing store.- Parameters:
mapType- must not be null.
-
MapKeyValueAdapter
Creates a newMapKeyValueAdapterusing the givenMapas backing store.- Parameters:
mapType- must not be null.sortAccessor- accessor granting access to sorting implementation- Since:
- 3.1.10
-
MapKeyValueAdapter
public MapKeyValueAdapter(Class<? extends Map> mapType, QueryEngine<? extends KeyValueAdapter, ?, ?> engine) Creates a newMapKeyValueAdapterusing the givenMapas backing store and query engine.- Parameters:
mapType- must not be null.engine- the query engine.- Since:
- 2.4
-
MapKeyValueAdapter
-
MapKeyValueAdapter
public MapKeyValueAdapter(Map<String, Map<Object, Object>> store, QueryEngine<? extends KeyValueAdapter, ?, ?> engine) Create new instance ofMapKeyValueAdapterusing given dataStore for persistence and query engine.- Parameters:
store- must not be null.engine- the query engine.- Since:
- 2.4
-
-
Method Details
-
put
Description copied from interface:KeyValueAdapterAdd 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
Description copied from interface:KeyValueAdapterCheck 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.
-
count
Description copied from interface:KeyValueAdapterCount number of objects within keyspace.- Parameters:
keyspace- must not be null.- Returns:
-
get
Description copied from interface:KeyValueAdapterGet 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.
-
delete
Description copied from interface:KeyValueAdapterDelete 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
-
getAllOf
Description copied from interface:KeyValueAdapterGet all elements for given keyspace.- Parameters:
keyspace- must not be null.- Returns:
- empty
Collectionif nothing found.
-
entries
Description copied from interface:KeyValueAdapterReturns aCloseableIteratorthat iterates over all entries.- Parameters:
keyspace- must not be null.- Returns:
-
deleteAllOf
Description copied from interface:KeyValueAdapterRemove all objects of given type.- Parameters:
keyspace- must not be null.
-
clear
-
destroy
-
getKeySpaceMap
-