Package com.google.api.client.util.store
Interface DataStore<V extends Serializable>
- Type Parameters:
V
- serializable type of the mapped value
- All Known Implementing Classes:
AbstractDataStore
,AbstractMemoryDataStore
,FileDataStoreFactory.FileDataStore
,MemoryDataStoreFactory.MemoryDataStore
public interface DataStore<V extends Serializable>
Stores and manages serializable data of a specific type, where the key is a string and the value
is a
Serializable
object.
null
keys or values are not allowed. Implementation should be thread-safe.
- Since:
- 1.16
-
Method Summary
Modifier and TypeMethodDescriptionclear()
Deletes all of the stored keys and values.boolean
containsKey
(String key) Returns whether the store contains the given key.boolean
containsValue
(V value) Returns whether the store contains the given value.Deletes the stored key and value based on the given key, or ignored if the key doesn't already exist.Returns the stored value for the given key ornull
if not found.Returns the data store factory.getId()
Returns the data store ID.boolean
isEmpty()
Returns whether there are any stored keys.keySet()
Returns the unmodifiable set of all stored keys.Stores the given value for the given key (replacing any existing value).int
size()
Returns the number of stored keys.values()
Returns the unmodifiable collection of all stored values.
-
Method Details
-
getDataStoreFactory
DataStoreFactory getDataStoreFactory()Returns the data store factory. -
getId
String getId()Returns the data store ID. -
size
Returns the number of stored keys.- Throws:
IOException
-
isEmpty
Returns whether there are any stored keys.- Throws:
IOException
-
containsKey
Returns whether the store contains the given key.- Throws:
IOException
-
containsValue
Returns whether the store contains the given value.- Throws:
IOException
-
keySet
Returns the unmodifiable set of all stored keys.Order of the keys is not specified.
- Throws:
IOException
-
values
Returns the unmodifiable collection of all stored values.- Throws:
IOException
-
get
Returns the stored value for the given key ornull
if not found.- Parameters:
key
- key ornull
fornull
result- Throws:
IOException
-
set
Stores the given value for the given key (replacing any existing value).- Parameters:
key
- keyvalue
- value object- Throws:
IOException
-
clear
Deletes all of the stored keys and values.- Throws:
IOException
-
delete
Deletes the stored key and value based on the given key, or ignored if the key doesn't already exist.- Parameters:
key
- key ornull
to ignore- Throws:
IOException
-