public interface KeyValueTemplate
| Modifier and Type | Method and Description |
|---|---|
<K> void |
delete(Iterable<K> keys)
Removes entities from keys
|
<K> void |
delete(K key)
Removes an entity from key
|
<K,T> Iterable<T> |
get(Iterable<K> keys,
Class<T> entityClass)
Finds a list of values from keys
|
<K,T> Optional<T> |
get(K key,
Class<T> entityClass)
Finds the Value from a key
|
<T> Optional<T> |
getSingleResult(String query,
Class<T> entityClass)
Executes query in the database then returns as single result
|
<T> PreparedStatement |
prepare(String query,
Class<T> entityClass)
Executes query with
PreparedStatement |
default <T> Iterable<T> |
put(Iterable<T> entities)
Saves the
Iterable of entities |
default <T> Iterable<T> |
put(Iterable<T> entities,
Duration ttl)
Saves the
Iterable of entities with a defined time to live |
<T> T |
put(T entity)
Saves the entity
|
<T> T |
put(T entity,
Duration ttl)
Saves the entity with time to live
|
void |
query(String query)
Executes query in the database and don't return result, e.g.: when the query is either remove or
put
|
<T> Stream<T> |
query(String query,
Class<T> entityClass)
Executes query in the database
|
<T> T put(T entity)
T - the entity typeentity - the entity to be insertNullPointerException - when entity is null<T> T put(T entity,
Duration ttl)
T - the entity typeentity - the entity to be insertttl - the defined time to liveNullPointerException - when entity is nullUnsupportedOperationException - when expired time is not supporteddefault <T> Iterable<T> put(Iterable<T> entities)
Iterable of entitiesT - the entity typeentities - keys to be insertNullPointerException - when the iterable is nulldefault <T> Iterable<T> put(Iterable<T> entities, Duration ttl)
Iterable of entities with a defined time to liveT - the entity typeentities - entities to be insertttl - the time to entity expireNullPointerException - when the iterable is nullUnsupportedOperationException - when expired time is not supported<K,T> Optional<T> get(K key, Class<T> entityClass)
K - the key typeT - the entity typekey - the keyentityClass - the entity class to convert the resultOptional when is not found will return a Optional.empty()NullPointerException - when the key is null<T> Stream<T> query(String query, Class<T> entityClass)
T - the entity typequery - the queryentityClass - the entity classNullPointerException - when query is null, if the query is get the entity class is required<T> Optional<T> getSingleResult(String query, Class<T> entityClass)
T - the entity typequery - the queryentityClass - the entity classOptional, if either put or remove it will return Optional.empty()NullPointerException - when query is null, if the query is get the entity class is requiredvoid query(String query)
query - the queryNullPointerException - when query is null<T> PreparedStatement prepare(String query, Class<T> entityClass)
PreparedStatementT - the entity typequery - the queryentityClass - the entity classPreparedStatement instanceNullPointerException - when query is null, if the query is get the entity class is required<K,T> Iterable<T> get(Iterable<K> keys, Class<T> entityClass)
K - the key typeT - the entity typeentityClass - the entity classkeys - the keys to be used in this queryNullPointerException - when either the keys or the entities values are null<K> void delete(K key)
K - the key typekey - the key bo be usedNullPointerException - when the key is null<K> void delete(Iterable<K> keys)
K - the key typekeys - the keys to be usedNullPointerException - when the key is nullCopyright © 2017–2019 Eclipse Foundation. All rights reserved.