Package com.google.api.client.util.store
Class AbstractDataStore<V extends Serializable>
java.lang.Object
com.google.api.client.util.store.AbstractDataStore<V>
- Type Parameters:
V
- serializable type of the mapped value
- All Implemented Interfaces:
DataStore<V>
- Direct Known Subclasses:
AbstractMemoryDataStore
public abstract class AbstractDataStore<V extends Serializable>
extends Object
implements DataStore<V>
Abstract data store implementation.
- Since:
- 1.16
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DataStoreFactory
Data store factory.private final String
Data store ID. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractDataStore
(DataStoreFactory dataStoreFactory, String id) -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(String key) Returns whether the store contains the given key.boolean
containsValue
(V value) Returns whether the store contains the given value.Returns the data store factory.final String
getId()
Returns the data store ID.boolean
isEmpty()
Returns whether there are any stored keys.int
size()
Returns the number of stored keys.
-
Field Details
-
dataStoreFactory
Data store factory. -
id
Data store ID.
-
-
Constructor Details
-
AbstractDataStore
- Parameters:
dataStoreFactory
- data store factoryid
- data store ID
-
-
Method Details
-
getDataStoreFactory
Returns the data store factory.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
- Specified by:
getDataStoreFactory
in interfaceDataStore<V extends Serializable>
-
getId
Description copied from interface:DataStore
Returns the data store ID.- Specified by:
getId
in interfaceDataStore<V extends Serializable>
-
containsKey
Returns whether the store contains the given key.Default implementation is to call
DataStore.get(String)
and check if it isnull
.- Specified by:
containsKey
in interfaceDataStore<V extends Serializable>
- Throws:
IOException
-
containsValue
Returns whether the store contains the given value.Default implementation is to call
Collection.contains(Object)
onDataStore.values()
.- Specified by:
containsValue
in interfaceDataStore<V extends Serializable>
- Throws:
IOException
-
isEmpty
Returns whether there are any stored keys.Default implementation is to check if
size()
is0
.- Specified by:
isEmpty
in interfaceDataStore<V extends Serializable>
- Throws:
IOException
-
size
Returns the number of stored keys.Default implementation is to call
Set.size()
onDataStore.keySet()
.- Specified by:
size
in interfaceDataStore<V extends Serializable>
- Throws:
IOException
-