Interface KeyValueOperations
- All Superinterfaces:
DisposableBean
- All Known Implementing Classes:
KeyValueTemplate
Interface that specifies a basic set of key/value operations. Implemented by
KeyValueTemplate.- Author:
- Christoph Strobl, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionlongTotal number of elements with given type available.longcount(KeyValueQuery<?> query, Class<?> type) Total number of elements matching given query.voidRemove all elements of type.<T> @Nullable TDelete item of type with given id.<T> @Nullable Tdelete(T objectToDelete) <T> @Nullable Texecute(KeyValueCallback<T> action) Execute operation against underlying store.booleanexists(KeyValueQuery<?> query, Class<?> type) Determine whether result of givenKeyValueQuerycontains at least one element.<T> Iterable<T> find(KeyValueQuery<?> query, Class<T> type) Get all elements matching the given query.<T> Iterable<T> Get all elements of given type.<T> Iterable<T> Get all elements ordered by sort.<T> Optional<T> Get element of given type with given id.<T> Iterable<T> findInRange(long offset, int rows, Class<T> type) Get all elements in given range.<T> Iterable<T> findInRange(long offset, int rows, Sort sort, Class<T> type) Get all elements in given range ordered by sort.MappingContext<?, ?> <T> TAdd object with given id.<T> Tinsert(T objectToInsert) Add given object.<T> T<T> Tupdate(T objectToUpdate) Methods inherited from interface DisposableBean
destroy
-
Method Details
-
insert
<T> T insert(T objectToInsert) Add given object. Object needs to have id property to which a generated value will be assigned.- Parameters:
objectToInsert-- Returns:
- the inserted object.
-
insert
Add object with given id.- Parameters:
id- must not be null.objectToInsert- must not be null.- Returns:
- the inserted object.
-
findAll
-
findAll
-
findById
Get element of given type with given id. RespectsKeySpaceif present and therefore returns all elements that can be assigned to requested type.- Parameters:
id- must not be null.type- must not be null.- Returns:
Optional.empty()if not found.
-
execute
Execute operation against underlying store.- Parameters:
action- must not be null.- Returns:
-
find
Get all elements matching the given query.
RespectsKeySpaceif present and therefore returns all elements that can be assigned to requested type..- Parameters:
query- must not be null.type- must not be null.- Returns:
- empty iterable if no match found.
-
findInRange
-
findInRange
-
update
<T> T update(T objectToUpdate) - Parameters:
objectToUpdate- must not be null.- Returns:
- the updated object.
-
update
- Parameters:
id- must not be null.objectToUpdate- must not be null.- Returns:
- the updated object.
-
delete
-
delete
<T> @Nullable T delete(T objectToDelete) - Parameters:
objectToDelete- must not be null.- Returns:
-
delete
-
count
-
count
Total number of elements matching given query. RespectsKeySpaceif present and therefore counts all elements that can be assigned to requested type.- Parameters:
query-type-- Returns:
-
exists
Determine whether result of givenKeyValueQuerycontains at least one element.- Parameters:
query-type-- Returns:
- Since:
- 2.7
-
getMappingContext
MappingContext<?,?> getMappingContext()- Returns:
- mapping context in use.
-
getKeyValueAdapter
KeyValueAdapter getKeyValueAdapter()- Returns:
KeyValueAdapterin use.- Since:
- 3.2.4
-