Package com.google.api.client.util.store
Class AbstractDataStore<V extends java.io.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 java.io.Serializable> extends java.lang.Object implements DataStore<V>
Abstract data store implementation.- Since:
- 1.16
-
-
Field Summary
Fields Modifier and Type Field Description private DataStoreFactorydataStoreFactoryData store factory.private java.lang.StringidData store ID.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDataStore(DataStoreFactory dataStoreFactory, java.lang.String id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(java.lang.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.java.lang.StringgetId()Returns the data store ID.booleanisEmpty()Returns whether there are any stored keys.intsize()Returns the number of stored keys.
-
-
-
Field Detail
-
dataStoreFactory
private final DataStoreFactory dataStoreFactory
Data store factory.
-
id
private final java.lang.String id
Data store ID.
-
-
Constructor Detail
-
AbstractDataStore
protected AbstractDataStore(DataStoreFactory dataStoreFactory, java.lang.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 java.io.Serializable>
-
getId
public final java.lang.String getId()
Description copied from interface:DataStoreReturns the data store ID.
-
containsKey
public boolean containsKey(java.lang.String key) throws java.io.IOExceptionReturns 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 java.io.Serializable>- Throws:
java.io.IOException
-
containsValue
public boolean containsValue(V value) throws java.io.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 java.io.Serializable>- Throws:
java.io.IOException
-
isEmpty
public boolean isEmpty() throws java.io.IOExceptionReturns whether there are any stored keys.Default implementation is to check if
size()is0.
-
size
public int size() throws java.io.IOExceptionReturns the number of stored keys.Default implementation is to call
Set.size()onDataStore.keySet().
-
-