Interface SOPersistentStorage

All Known Implementing Classes:
DefaultPersistentStorage

public interface SOPersistentStorage
This interface specifies the basis for implementing a class allowing for storage/retrieval of key/value pairs.
  • Method Summary

    Modifier and Type
    Method
    Description
    This method will be called to retrieve all entries from the persistent store.
    getStorageObject(android.content.Context context, String storeName)
    This method will be called to obtain a storage object for the named store.

    getStringPreference(Object storageObject, String key, String defaultValue)
    This method will be called to retrieve data, identified by key, from the store.

    The default value should be returned if the key does not reside in the store.
    void
    removePreference(Object storageObject, String key)
    This method will be called to remove an entry from the persistent store.
    void
    setStringPreference(Object storageObject, String key, String value)
    This method will be called to set a key/value pair in the store.

  • Method Details

    • getStorageObject

      Object getStorageObject(android.content.Context context, String storeName)
      This method will be called to obtain a storage object for the named store.

      Parameters:
      context - The application context
      storeName - The data store identifier
      Returns:
      The object to be used to manage the store.
    • setStringPreference

      void setStringPreference(Object storageObject, String key, String value)
      This method will be called to set a key/value pair in the store.

      Parameters:
      storageObject - The object to be used to manage the store.
      key - The data key
      value - The data value
    • getStringPreference

      String getStringPreference(Object storageObject, String key, String defaultValue)
      This method will be called to retrieve data, identified by key, from the store.

      The default value should be returned if the key does not reside in the store.
      Parameters:
      storageObject - The object to be used to manage the store.
      key - The data key
      defaultValue - The default data value
      Returns:
      The retrieved string.
    • getAllStringPreferences

      Map<String,?> getAllStringPreferences(Object storageObject)
      This method will be called to retrieve all entries from the persistent store.

      Parameters:
      storageObject - The object to be used to manage the store.
      Returns:
      The retrieved key/value pairs.
    • removePreference

      void removePreference(Object storageObject, String key)
      This method will be called to remove an entry from the persistent store. .

      Parameters:
      storageObject - The object to be used to manage the store.
      key - The data key