Preferences class

Consists of the methods used to set the HTTP Parameters used for connection with the backend.

Package

com.sap.mobile.lib.configuration

Syntax

public class Preferences implements IPreferences, Constants

Implemented interfaces

Members

All members of Preferences, including inherited members.

Variables
Modifier and Type Variable Description
protected static final String PREFERENCES  
public static String DEFAULT_PERSISTENCE_STRING_SUBFOLDER_NAME Default subfolder for Persistence.
public static String DEFAULT_PARSER_STRING_SUBFOLDER_NAME Default subfolder for Parser.
protected Hashtable< String, Set< IPreferenceChangeListener > > preferenceChangeListeners Listeners for Preference changes.
protected Hashtable< String, Object > defaultPreferences Store for default Preferences.
protected ILogger logger  
protected int logLevel  
Constructors
Modifier and Type Constructor Description
public Preferences(Context, ILogger)  
Methods
Modifier and Type Method Description
protected void addDefaultPreferences() Can be used to add application specific default preferences.
protected Object confirmPreference(String) Validates changed preference if it can be changed.
public boolean containsPreference(String) Checks the existence of the given preference.
public Map< String,?> getAllPreferences()  
public Boolean getBooleanPreference(String) Returns the value of the given preference or null if there is no preference with the given key.
public Context getContext() Returns the context.
public Float getFloatPreference(String) Returns the value of the given preference or null if there is no preference with the given key.
public Integer getIntPreference(String) Returns the value of the given preference or null if there is no preference with the given key.
public Long getLongPreference(String) Returns the value of the given preference or null if there is no preference with the given key.
public String getStringPreference(String) Returns the value of the given preference or null if there is no preference with the given key.
public void onSharedPreferenceChanged(SharedPreferences, final String)  
public synchronized void registerPreferenceChangeListener(String, IPreferenceChangeListener) You can register a class implementing the IPreferenceChangeListener interface for the change of a preference with the given key.
public void removePreference(String) Removes the preferences with the given key.
public void resetPreference(String) Resets the preference's value to it's default value or to null if there is no default value for the given preference.
public void setBooleanPreference(String, boolean) Sets and validates and persists the value of the preferences with the given type.
public void setFloatPreference(String, float) Sets and validates and persists the value of the preferences with the given type.
public void setIntPreference(String, int) Sets and validates and persists the value of the preferences with the given type.
public void setLongPreference(String, long) Sets and validates and persists the value of the preferences with the given type.
public void setStringPreference(String, String) Sets and validates and persists the value of the preferences with the given type.
public synchronized void unRegisterPreferenceChangeListener(String, IPreferenceChangeListener) You can unregister a change listener.