public interface UserStore
SyncManager.setUserStore(UserStore)
,
SharedPrefsUserStore
Any implementation of a User Store is expected to not perform lengthy blocking operations as it might be called on the Main Thread. All implementations of this interface should be thread safe.
Modifier and Type | Field and Description |
---|---|
static String |
CURRENT_USER_KEY |
Modifier and Type | Method and Description |
---|---|
Collection<SyncUser> |
allUsers()
Returns a collection of all users saved in the User store.
|
void |
clear()
Removes all saved users.
|
SyncUser |
get(String key)
Retrieves the
SyncUser with the given key. |
SyncUser |
put(String key,
SyncUser user)
Saves a
SyncUser object under the given key. |
SyncUser |
remove(String key)
Removes the user with the given key from the store.
|
static final String CURRENT_USER_KEY
SyncUser put(String key, SyncUser user)
SyncUser
object under the given key. If another user already exists, it will be replaced.key
- key used to store the User.user
- SyncUser
object to store.null
if no user was replaced.SyncUser get(String key)
SyncUser
with the given key.key
- SyncUser
saved under the given key or null
if no user exists for that key.SyncUser remove(String key)
key
- key for the user to remove.SyncUser
that was removed or null
if no user matched the key.Collection<SyncUser> allUsers()
void clear()