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<User> |
allUsers()
Returns a collection of all users saved in the User store.
|
User |
get(String key)
Retrieves the
User with the given key. |
User |
put(String key,
User user)
Saves a
User object under the given key. |
User |
remove(String key)
Removes the user with the given key from the store.
|
static final String CURRENT_USER_KEY
User put(String key, User user)
User
object under the given key. If another user already exists, it will be replaced.key
- key used to store the User.user
- User
object to store.null
if no user was replaced.User get(String key)
User
with the given key.key
- User
saved under the given key or null
if no user exists for that key.User remove(String key)
key
- key for the user to remove.User
that was removed or null
if no user matched the key.Collection<User> allUsers()