Package sfs2x.client.entities.managers
Class SFSUserManager
- java.lang.Object
-
- sfs2x.client.entities.managers.SFSUserManager
-
- All Implemented Interfaces:
IUserManager
public class SFSUserManager extends java.lang.Object implements 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:
SmartFox.getUserManager()
-
-
Constructor Summary
Constructors Constructor Description SFSUserManager(ISmartFox smartFox)Creates a new SFSUserManager instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddUser(User user)* API internal usage only *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(java.lang.String userName)Indicates whether a user exists in the local users list or not from the name.ISmartFoxgetSmartFox()* API internal usage only *UsergetUserById(int userId)Retrieves a User object from its id property.UsergetUserByName(java.lang.String userName)Retrieves a User object from its name property.intgetUserCount()Returns the total number of users in the local users list.java.util.List<User>getUserList()Get the whole list of users inside the Rooms joined by the client.voidremoveUser(User user)* API internal usage only *voidremoveUserById(int id)* API internal usage only *voidreplaceAll(java.util.List<User> userList)* API internal usage only *
-
-
-
Constructor Detail
-
SFSUserManager
public SFSUserManager(ISmartFox smartFox)
Creates a new SFSUserManager instance.NOTE: developers never instantiate a SFSUserManager manually: this is done by the SmartFoxServer 2X API internally. A reference to the existing instance can be retrieved using the SmartFox.getUserManager() method.
- Parameters:
smartFox- An instance of the SmartFoxServer 2X client API main SmartFox class.- See Also:
SmartFox.getUserManager()
-
-
Method Detail
-
containsUserName
public boolean containsUserName(java.lang.String userName)
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:
User.getName()
-
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:
User.getId()
-
containsUser
public boolean containsUser(User user)
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
public User getUserByName(java.lang.String userName)
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:
User.getName(),IUserManager.getUserById(int)
-
getUserById
public User getUserById(int userId)
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:
User.getId(),IUserManager.getUserByName(java.lang.String)
-
addUser
public void addUser(User user)
Description copied from interface:IUserManager* API internal usage only *- Specified by:
addUserin interfaceIUserManager
-
removeUser
public void removeUser(User user)
Description copied from interface:IUserManager* API internal usage only *- Specified by:
removeUserin interfaceIUserManager
-
removeUserById
public void removeUserById(int id)
Description copied from interface:IUserManager* API internal usage only *- 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
public java.util.List<User> 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
public ISmartFox getSmartFox()
Description copied from interface:IUserManager* API internal usage only *- Specified by:
getSmartFoxin interfaceIUserManager
-
replaceAll
public void replaceAll(java.util.List<User> userList)
Description copied from interface:IUserManager* API internal usage only *- Specified by:
replaceAllin interfaceIUserManager
-
-