Interface KeyValueTable
-
- All Known Implementing Classes:
DefaultKeyValueTable
,ReadOnlyKeyValueTable
public interface KeyValueTable
A representation of a table which holds key-value pairs.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
delete(String key)
Deletes the value stored under the provided key from this table.Variant
fetch(String key)
Fetches the value stored under the provided key.Map<String,Variant>
fetchAll()
Fetches all key-value pairs and returns them as a Map.List<Variant>
getAllWhere(Column filter)
Returns all values from this table where the record matches the provided filter.void
update(String key, Variant value)
Updates the value stored under the provided key.void
updateAll(List<KeyValue> keyValues)
Updates the key-value pairs.void
updateMany(List<String> keys, String fieldName, Variant fieldValue)
Updates the provided field of the Variant value stored under the provided keys.
-
-
-
Method Detail
-
fetch
Variant fetch(String key)
Fetches the value stored under the provided key.- Parameters:
key
- key associated with the value- Returns:
- value stored under the provided key
- Throws:
KeyNotFoundException
- if no object under provided key exists
-
fetchAll
Map<String,Variant> fetchAll()
Fetches all key-value pairs and returns them as a Map.- Returns:
- all key-value pairs
-
update
void update(String key, Variant value)
Updates the value stored under the provided key.If no value is currently stored under the provided key - it will be inserted into this table.
- Parameters:
key
- key associated with the valuevalue
- value
-
getAllWhere
List<Variant> getAllWhere(Column filter)
Returns all values from this table where the record matches the provided filter.- Parameters:
filter
- filter for the table records- Returns:
- values from records which match the provided filter
-
updateMany
void updateMany(List<String> keys, String fieldName, Variant fieldValue)
Updates the provided field of the Variant value stored under the provided keys.If no value is currently stored under the provided key - it will be ignored.
- Parameters:
keys
- keys associated with the valuesfieldName
- name of the updated value fieldfieldValue
- new value for the updated field
-
updateAll
void updateAll(List<KeyValue> keyValues)
Updates the key-value pairs.If no value is currently stored under the provided key - it will be inserted into this table.
- Parameters:
keyValues
- list of key-value pairs
-
delete
void delete(String key)
Deletes the value stored under the provided key from this table.- Parameters:
key
- key associated with the value
-
-