Package sfs3.client.entities.managers
Class SFSUserManager
java.lang.Object
sfs3.client.entities.managers.SFSUserManager
- All Implemented Interfaces:
IUserManager
The SFSUserManager class is the entity in charge of managing the local (client-side) users list. It keeps track of all the users that are currently joined in the same Rooms of the current user. It also provides utility methods to look for users by name and id.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidaddUserInternal(User user) booleancontainsUser(User user) Indicates whether a user exists in the local users list or not.booleancontainsUserId(int userId) Indicates whether a user exists in the local users list or not from the id.booleancontainsUserName(String userName) Indicates whether a user exists in the local users list or not from the name.getUserById(int userId) Retrieves a User object from its id property.getUserByName(String userName) Retrieves a User object from its name property.intReturns the total number of users in the local users list.Get the whole list of users inside the Rooms joined by the client.voidremoveUser(User user) voidremoveUserById(int id)
-
Field Details
-
log
protected org.slf4j.Logger log -
smartFox
-
-
Constructor Details
-
SFSUserManager
Creates a new SFSUserManager instance.NOTE: developers never instantiate a SFSUserManager manually: this is done by the SmartFoxServer 3 API internally. A reference to the existing instance can be retrieved using the SmartFox.getUserManager() method.
- Parameters:
smartFox- An instance of the SmartFoxServer 3 client API main SmartFox class.- See Also:
-
-
Method Details
-
containsUserName
Description copied from interface:IUserManagerIndicates whether a user exists in the local users list or not from the name.- Specified by:
containsUserNamein interfaceIUserManager- Parameters:
userName- The name of the user whose presence in the users list is to be tested.- Returns:
trueif the passed user exists in the users list.- See Also:
-
containsUserId
public boolean containsUserId(int userId) Description copied from interface:IUserManagerIndicates whether a user exists in the local users list or not from the id.- Specified by:
containsUserIdin interfaceIUserManager- Parameters:
userId- The id of the user whose presence in the users list is to be tested.- Returns:
trueif the passed user exists in the users list.- See Also:
-
containsUser
Description copied from interface:IUserManagerIndicates whether a user exists in the local users list or not.- Specified by:
containsUserin interfaceIUserManager- Parameters:
user- The User object representing the user whose presence in the users list is to be tested.- Returns:
trueif the passed user exists in the users list.
-
getUserByName
Description copied from interface:IUserManagerRetrieves a User object from its name property.- Specified by:
getUserByNamein interfaceIUserManager- Parameters:
userName- The name of the user to be found.- Returns:
- The User object representing the user, or
nullif no user with the passed name exists in the local users list. - See Also:
-
getUserById
Description copied from interface:IUserManagerRetrieves a User object from its id property.- Specified by:
getUserByIdin interfaceIUserManager- Parameters:
userId- The id of the user to be found.- Returns:
- The User object representing the user, or
nullif no user with the passed id exists in the local users list. - See Also:
-
addUser
- Specified by:
addUserin interfaceIUserManager
-
addUserInternal
-
removeUser
- Specified by:
removeUserin interfaceIUserManager
-
removeUserById
public void removeUserById(int id) - Specified by:
removeUserByIdin interfaceIUserManager
-
getUserCount
public int getUserCount()Description copied from interface:IUserManagerReturns the total number of users in the local users list.- Specified by:
getUserCountin interfaceIUserManager
-
getUserList
Description copied from interface:IUserManagerGet the whole list of users inside the Rooms joined by the client.- Specified by:
getUserListin interfaceIUserManager- Returns:
- The list of User objects representing the users in the local users list.
-
getSmartFox
- Specified by:
getSmartFoxin interfaceIUserManager
-