WIMM Labs


com.wimm.framework.provider
Class SyncPreference

java.lang.Object
  extended by com.wimm.framework.provider.SyncPreference

public final class SyncPreference
extends Object

Interface for accessing and modifying web preference data.

Refer to WIMM Developer's Guide on Sync Preference settings for more information about developing Sync Preference supported MicroApp.

Since:
WIMM SDK 1.0.4
See Also:
SyncService

Constructor Summary
SyncPreference()
           
 
Method Summary
static boolean getBoolean(Context context, String name, boolean defaultValue)
          Returns a boolean value of the preference stored for the given name, or the default value provided if the preference could not be found or parsed.
static double getDouble(Context context, String name, double defaultValue)
          Returns a double value of the preference stored for the given name, or the default value provided if the preference could not be found or parsed.
static int getInt(Context context, String name, int defaultValue)
          Returns an integer value of the preference stored for the given name, or the default value provided if the preference could not be found or parsed.
static JSONArray getJSONArray(Context context, String name, JSONArray defaultValue)
          Returns the JSONArray value of the preference stored for the given name, or the default value provided if the preference could not be found or parsed.
static JSONObject getJSONObject(Context context, String name, JSONObject defaultValue)
          Returns the JSONObject value of the preference stored for the given name, or the default value provided if the preference could not be found or parsed.
static String getString(Context context, String name, String defaultValue)
          Returns a string value of the preference stored for the given name, or the default value provided if the preference could not be found or parsed.
static boolean putBoolean(Context context, String name, boolean content)
          Stores a boolean value that will be persisted and synced with the service.
static boolean putDouble(Context context, String name, double content)
          Stores a double precision float value that will be persisted and synced with the service.
static boolean putInt(Context context, String name, int content)
          Stores an integer value that will be persisted and synced with the service.
static boolean putJSONArray(Context context, String name, JSONArray content)
          Stores a JSONArray that will be persisted and synced with the service.
static boolean putJSONObject(Context context, String name, JSONObject content)
          Stores a JSONObject value that will be persisted and synced with the service.
static boolean putString(Context context, String name, String content)
          Stores a string value that will be persisted and synced with the service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyncPreference

public SyncPreference()
Method Detail

getJSONObject

public static final JSONObject getJSONObject(Context context,
                                             String name,
                                             JSONObject defaultValue)
Returns the JSONObject value of the preference stored for the given name, or the default value provided if the preference could not be found or parsed.

Parameters:
context - The Context.
name - The name (key) for identifying the preference.
defaultValue - The default value to return if the preference is not found.

getJSONArray

public static final JSONArray getJSONArray(Context context,
                                           String name,
                                           JSONArray defaultValue)
Returns the JSONArray value of the preference stored for the given name, or the default value provided if the preference could not be found or parsed.

Parameters:
context - The Context.
name - The name (key) for identifying the preference.
defaultValue - The default value to return if the preference is not found.

getBoolean

public static final boolean getBoolean(Context context,
                                       String name,
                                       boolean defaultValue)
Returns a boolean value of the preference stored for the given name, or the default value provided if the preference could not be found or parsed.

Parameters:
context - The Context.
name - The name (key) for identifying the preference.
defaultValue - The default value to return if the preference is not found.

getString

public static final String getString(Context context,
                                     String name,
                                     String defaultValue)
Returns a string value of the preference stored for the given name, or the default value provided if the preference could not be found or parsed.

Parameters:
context - The Context.
name - The name (key) for identifying the preference.
defaultValue - The default value to return if the preference is not found.

getDouble

public static final double getDouble(Context context,
                                     String name,
                                     double defaultValue)
Returns a double value of the preference stored for the given name, or the default value provided if the preference could not be found or parsed.

Parameters:
context - The Context.
name - The name (key) for identifying the preference.
defaultValue - The default value to return if the preference is not found.

getInt

public static final int getInt(Context context,
                               String name,
                               int defaultValue)
Returns an integer value of the preference stored for the given name, or the default value provided if the preference could not be found or parsed.

Parameters:
context - The Context.
name - The name (key) for identifying the preference.
defaultValue - The default value to return if the preference is not found.

putJSONArray

public static final boolean putJSONArray(Context context,
                                         String name,
                                         JSONArray content)
Stores a JSONArray that will be persisted and synced with the service. Used for persisting arrays of data. The elements should be simple types.

Parameters:
context - The Context.
name - The name (key) for identifying the preference.
content - The value to store.

putJSONObject

public static final boolean putJSONObject(Context context,
                                          String name,
                                          JSONObject content)
Stores a JSONObject value that will be persisted and synced with the service. Used for persisting complex types.

Parameters:
context - The Context.
name - The name (key) for identifying the preference.
content - The value to store.

putBoolean

public static final boolean putBoolean(Context context,
                                       String name,
                                       boolean content)
Stores a boolean value that will be persisted and synced with the service.

Parameters:
context - The Context.
name - The name (key) for identifying the preference.
content - The value to store.

putDouble

public static final boolean putDouble(Context context,
                                      String name,
                                      double content)
Stores a double precision float value that will be persisted and synced with the service.

Parameters:
context - The Context.
name - The name (key) for identifying the preference.
content - The value to store.

putString

public static final boolean putString(Context context,
                                      String name,
                                      String content)
Stores a string value that will be persisted and synced with the service.

Parameters:
context - The Context.
name - The name (key) for identifying the preference.
content - The value to store.

putInt

public static final boolean putInt(Context context,
                                   String name,
                                   int content)
Stores an integer value that will be persisted and synced with the service.

Parameters:
context - The Context.
name - The name (key) for identifying the preference.
content - The value to store.

WIMM Labs