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 protectedAbstractDataStore(DataStoreFactory dataStoreFactory, String id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(String key)Returns whether the store contains the given key.booleancontainsValue(V value)Returns whether the store contains the given value.DataStoreFactorygetDataStoreFactory()Returns the data store factory.StringgetId()Returns the data store ID.booleanisEmpty()Returns whether there are any stored keys.intsize()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:
getDataStoreFactoryin interfaceDataStore<V extends Serializable>
-
getId
public final String getId()
Description copied from interface:DataStoreReturns the data store ID.- Specified by:
getIdin 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:
containsKeyin 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:
containsValuein interfaceDataStore<V extends Serializable>- Throws:
IOException
-
isEmpty
public boolean isEmpty() throws IOExceptionReturns whether there are any stored keys.Default implementation is to check if
size()is0.- Specified by:
isEmptyin interfaceDataStore<V extends Serializable>- Throws:
IOException
-
size
public int size() throws IOExceptionReturns the number of stored keys.Default implementation is to call
Set.size()onDataStore.keySet().- Specified by:
sizein interfaceDataStore<V extends Serializable>- Throws:
IOException
-
-