Package 

Interface ICTPreference


  • 
    public interface ICTPreference
    
                        

    The ICTPreference interface defines a set of methods for interacting with shared preferences to read and write various data types. It provides flexibility in handling preferences for different data types such as strings, booleans, integers, longs, floats, string sets, and maps.

    <p> The implementation of this interface should encapsulate the underlying storage mechanism for shared preferences, allowing the CleverTap SDK to store and retrieve preference data in a specific manner. </p>
    • Method Detail

      • readString

         abstract String readString(String key, String default)

        Reads a string from the shared preferences.

        Parameters:
        key - The key associated with the value.
        default - The default value to return if the key is not present.
      • readBoolean

         abstract Boolean readBoolean(String key, Boolean default)

        Reads a boolean from the shared preferences.

        Parameters:
        key - The key associated with the value.
        default - The default value to return if the key is not present.
      • readInt

         abstract Integer readInt(String key, Integer default)

        Reads an integer from the shared preferences.

        Parameters:
        key - The key associated with the value.
        default - The default value to return if the key is not present.
      • readLong

         abstract Long readLong(String key, Long default)

        Reads a long from the shared preferences.

        Parameters:
        key - The key associated with the value.
        default - The default value to return if the key is not present.
      • readFloat

         abstract Float readFloat(String key, Float default)

        Reads a float from the shared preferences.

        Parameters:
        key - The key associated with the value.
        default - The default value to return if the key is not present.
      • readStringSet

         abstract Set<String> readStringSet(String key, Set<String> default)

        Reads a string set from the shared preferences.

        Parameters:
        key - The key associated with the value.
        default - The default value to return if the key is not present.
      • readAll

         abstract Map<String, ?> readAll()

        Reads all key-value pairs from the shared preferences.

      • writeString

         abstract Unit writeString(String key, String value)

        Writes a string to the shared preferences.

        Parameters:
        key - The key associated with the value.
        value - The string value to be stored.
      • writeBoolean

         abstract Unit writeBoolean(String key, Boolean value)

        Writes a boolean to the shared preferences.

        Parameters:
        key - The key associated with the value.
        value - The boolean value to be stored.
      • writeInt

         abstract Unit writeInt(String key, Integer value)

        Writes an integer to the shared preferences.

        Parameters:
        key - The key associated with the value.
        value - The integer value to be stored.
      • writeLong

         abstract Unit writeLong(String key, Long value)

        Writes a long to the shared preferences.

        Parameters:
        key - The key associated with the value.
        value - The long value to be stored.
      • writeFloat

         abstract Unit writeFloat(String key, Float value)

        Writes a float to the shared preferences.

        Parameters:
        key - The key associated with the value.
        value - The float value to be stored.
      • writeStringSet

         abstract Unit writeStringSet(String key, Set<String> value)

        Writes a string set to the shared preferences.

        Parameters:
        key - The key associated with the value.
        value - The string set value to be stored.
      • writeMap

         abstract Unit writeMap(String key, Map<String, ?> value)

        Writes a map to the shared preferences.

        Parameters:
        key - The key associated with the value.
        value - The map value to be stored.
      • writeStringImmediate

         abstract Unit writeStringImmediate(String key, String value)

        Writes a string to the shared preferences immediately (without applying changes asynchronously).

        Parameters:
        key - The key associated with the value.
        value - The string value to be stored.
      • writeBooleanImmediate

         abstract Unit writeBooleanImmediate(String key, Boolean value)

        Writes a boolean to the shared preferences immediately (without applying changes asynchronously).

        Parameters:
        key - The key associated with the value.
        value - The boolean value to be stored.
      • writeIntImmediate

         abstract Unit writeIntImmediate(String key, Integer value)

        Writes an integer to the shared preferences immediately (without applying changes asynchronously).

        Parameters:
        key - The key associated with the value.
        value - The integer value to be stored.
      • writeLongImmediate

         abstract Unit writeLongImmediate(String key, Long value)

        Writes a long to the shared preferences immediately (without applying changes asynchronously).

        Parameters:
        key - The key associated with the value.
        value - The long value to be stored.
      • writeFloatImmediate

         abstract Unit writeFloatImmediate(String key, Float value)

        Writes a float to the shared preferences immediately (without applying changes asynchronously).

        Parameters:
        key - The key associated with the value.
        value - The float value to be stored.
      • writeStringSetImmediate

         abstract Unit writeStringSetImmediate(String key, Set<String> value)

        Writes a string set to the shared preferences immediately (without applying changes asynchronously).

        Parameters:
        key - The key associated with the value.
        value - The string set value to be stored.
      • writeMapImmediate

         abstract Unit writeMapImmediate(String key, Map<String, ?> value)

        Writes a map to the shared preferences immediately (without applying changes asynchronously).

        Parameters:
        key - The key associated with the value.
        value - The map value to be stored.
      • isEmpty

         abstract Boolean isEmpty()

        Checks if the shared preferences are empty.

      • size

         abstract Integer size()

        Gets the size (number of key-value pairs) of the shared preferences.

      • remove

         abstract Unit remove(String key)

        Removes a key and its associated value from the shared preferences.

        Parameters:
        key - The key to be removed.
      • removeImmediate

         abstract Unit removeImmediate(String key)

        Removes a key and its associated value from the shared preferences immediately (without applying changes asynchronously).

        Parameters:
        key - The key to be removed.
      • changePreferenceName

         abstract Unit changePreferenceName(String prefName)

        Changes the name of the shared preferences.

        Parameters:
        prefName - The new name for the shared preferences.