Class DefaultKeyValueStateRepository<T>
- java.lang.Object
-
- com.snowflake.connectors.common.state.DefaultKeyValueStateRepository<T>
-
- All Implemented Interfaces:
KeyValueStateRepository<T>
public class DefaultKeyValueStateRepository<T> extends Object implements KeyValueStateRepository<T>
Default implementation ofKeyValueStateRepository
.
-
-
Constructor Summary
Constructors Constructor Description DefaultKeyValueStateRepository(KeyValueTable table, Class<T> clazz)
Creates a newDefaultKeyValueStateRepository
, using the provided table for data storage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
fetch(String key)
Fetches the state value stored under the provided key in this repository.void
update(String key, T value)
Updates the provided state value, stored under the provided key, in this repository.
-
-
-
Constructor Detail
-
DefaultKeyValueStateRepository
public DefaultKeyValueStateRepository(KeyValueTable table, Class<T> clazz)
Creates a newDefaultKeyValueStateRepository
, using the provided table for data storage.- Parameters:
table
- key-value table used for data storageclazz
- class representing state values stored in this repository
-
-
Method Detail
-
fetch
public T fetch(String key)
Description copied from interface:KeyValueStateRepository
Fetches the state value stored under the provided key in this repository.- Specified by:
fetch
in interfaceKeyValueStateRepository<T>
- Parameters:
key
- key associated with the state value- Returns:
- object stored under the provided key in this repository
-
update
public void update(String key, T value)
Description copied from interface:KeyValueStateRepository
Updates the provided state value, stored under the provided key, in this repository.If no value is currently stored under the provided key - it will be inserted into this repository.
- Specified by:
update
in interfaceKeyValueStateRepository<T>
- Parameters:
key
- key associated with the state valuevalue
- state value
-
-