Class MachineIdPrefsStorage

  • All Implemented Interfaces:
    BaseStorage, MachineIdStorage


    public final class MachineIdPrefsStorage
    extends java.lang.Object
    implements MachineIdStorage
    Storage for saving the machine id of a chat session.

    Machine id is defined during initialization and is used to reconnect to a chat if still active.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void delete()
      Deletes all storage information saved in this shared preference
      void disable()
      Disables the storage
      java.lang.String getMachineId()
      Retrieves stored machine id from shared preferences.
      void setMachineId(java.lang.String machineId)
      Saves the provided machine id in shared preferences.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mStoragePreferences

        protected final SharedPreferences mStoragePreferences
      • mDisabled

        protected boolean mDisabled
    • Method Detail

      • setMachineId

        public void setMachineId(java.lang.String machineId)
        Saves the provided machine id in shared preferences.

        If storage is disabled via PrefsStorage.disable() this will do nothing.

        Specified by:
        setMachineId in interface MachineIdStorage
        Parameters:
        machineId - to save
        Throws:
        java.lang.IllegalArgumentException - if machine id was null
      • getMachineId

        public java.lang.String getMachineId()
        Retrieves stored machine id from shared preferences.

        If storage is disabled via PrefsStorage.disable() this will return null.

        Specified by:
        getMachineId in interface MachineIdStorage
        Returns:
        machine id of a saved chat session or null if there was none
      • delete

        public void delete()
        Deletes all storage information saved in this shared preference
        Specified by:
        delete in interface BaseStorage
      • disable

        public void disable()
        Description copied from interface: BaseStorage
        Disables the storage
        Specified by:
        disable in interface BaseStorage