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>
public abstract class AbstractDataStore<V extends Serializable> extends Object implements DataStore<V>
Abstract data store implementation.- Since:
- 1.16
- Author:
- Yaniv Inbar
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractDataStore(DataStoreFactory dataStoreFactory, String id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(String key)
Returns whether the store contains the given key.boolean
containsValue(V value)
Returns whether the store contains the given value.DataStoreFactory
getDataStoreFactory()
Returns the data store factory.String
getId()
Returns the data store ID.boolean
isEmpty()
Returns whether there are any stored keys.int
size()
Returns the number of stored keys.
-
-
-
Constructor Detail
-
AbstractDataStore
protected AbstractDataStore(DataStoreFactory dataStoreFactory, String id)
- Parameters:
dataStoreFactory
- data store factoryid
- data store ID
-
-
Method Detail
-
getDataStoreFactory
public DataStoreFactory 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
public final String getId()
Description copied from interface:DataStore
Returns the data store ID.- Specified by:
getId
in interfaceDataStore<V extends Serializable>
-
containsKey
public boolean containsKey(String key) throws IOException
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
public boolean containsValue(V value) throws IOException
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
public boolean isEmpty() throws IOException
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
public int size() throws IOException
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
-
-