com.facebook
Class SharedPreferencesTokenCachingStrategy

java.lang.Object
  extended by com.facebook.TokenCachingStrategy
      extended by com.facebook.SharedPreferencesTokenCachingStrategy

public class SharedPreferencesTokenCachingStrategy
extends TokenCachingStrategy


Field Summary
 
Fields inherited from class com.facebook.TokenCachingStrategy
EXPIRATION_DATE_KEY, LAST_REFRESH_DATE_KEY, PERMISSIONS_KEY, TOKEN_KEY, TOKEN_SOURCE_KEY, USER_FBID_KEY
 
Constructor Summary
SharedPreferencesTokenCachingStrategy(Context context)
          Creates a default SharedPreferencesTokenCachingStrategy instance that provides access to a single set of token information.
SharedPreferencesTokenCachingStrategy(Context context, String cacheKey)
          Creates a SharedPreferencesTokenCachingStrategy instance that is distinct for the passed in cacheKey.
 
Method Summary
 void clear()
          Clears out all token information stored in this cache.
 Bundle load()
          Returns a Bundle that contains the information stored in this cache
 void save(Bundle bundle)
          Persists all supported data types present in the passed in Bundle, to the cache
 
Methods inherited from class com.facebook.TokenCachingStrategy
getExpirationDate, getExpirationMilliseconds, getLastRefreshDate, getLastRefreshMilliseconds, getPermissions, getSource, getToken, hasTokenInformation, putExpirationDate, putExpirationMilliseconds, putLastRefreshDate, putLastRefreshMilliseconds, putPermissions, putSource, putToken
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharedPreferencesTokenCachingStrategy

public SharedPreferencesTokenCachingStrategy(Context context)
Creates a default SharedPreferencesTokenCachingStrategy instance that provides access to a single set of token information.

Parameters:
context - The Context object to use to get the SharedPreferences object.
Throws:
NullPointerException - if the passed in Context is null

SharedPreferencesTokenCachingStrategy

public SharedPreferencesTokenCachingStrategy(Context context,
                                             String cacheKey)
Creates a SharedPreferencesTokenCachingStrategy instance that is distinct for the passed in cacheKey.

Parameters:
context - The Context object to use to get the SharedPreferences object.
cacheKey - Identifies a distinct set of token information.
Throws:
NullPointerException - if the passed in Context is null
Method Detail

load

public Bundle load()
Returns a Bundle that contains the information stored in this cache

Specified by:
load in class TokenCachingStrategy
Returns:
A Bundle with the information contained in this cache

save

public void save(Bundle bundle)
Persists all supported data types present in the passed in Bundle, to the cache

Specified by:
save in class TokenCachingStrategy
Parameters:
bundle - The Bundle containing information to be cached

clear

public void clear()
Clears out all token information stored in this cache.

Specified by:
clear in class TokenCachingStrategy