Package sfs2x.client.requests
Class FindRoomsRequest
- java.lang.Object
-
- sfs2x.client.requests.BaseRequest
-
- sfs2x.client.requests.FindRoomsRequest
-
- All Implemented Interfaces:
sfs2x.client.requests.IRequest
public class FindRoomsRequest extends BaseRequest
Retrieves a list of Rooms from the server which match the specified criteria.By providing a matching expression and a search scope (a Group or the entire Zone), SmartFoxServer can find those Rooms matching the passed criteria and return them by means of the roomFindResult event.
Example
The following example looks for all the server Rooms whose "country" Room Variable is set toSweden
:private void someMethod() { sfs.addEventListener(SFSEvent.ROOM_FIND_RESULT, new IEventListener() { public void dispatch(BaseEvent evt) throws SFSException { System.out.println("Rooms found: " + evt.getArguments().get("rooms")); } }); // Create a matching expression to find Rooms with a "country" variable equal to "Sweden" MatchExpression exp = new MatchExpression("country", StringMatch.EQUALS, "Sweden"); // Find the Rooms sfs.send(new FindRoomsRequest(exp)); }
- See Also:
MatchExpression
,SFSEvent.ROOM_FIND_RESULT
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
KEY_EXPRESSION
* API internal usage only *static java.lang.String
KEY_FILTERED_ROOMS
* API internal usage only *static java.lang.String
KEY_GROUP
* API internal usage only *static java.lang.String
KEY_LIMIT
* API internal usage only *-
Fields inherited from class sfs2x.client.requests.BaseRequest
AddBuddy, AdminMessage, AutoJoin, BanUser, BlockBuddy, CallExtension, ChangeRoomCapacity, ChangeRoomName, ChangeRoomPassword, ClusterInviteUsers, ClusterJoinOrCreate, CreateRoom, CreateSFSGame, FindRooms, FindUsers, GameServerConnectionRequired, GenericMessage, GetRoomList, GoOnline, Handshake, InitBuddyList, InvitationReply, InviteUser, JoinRoom, JoinRoomInvite, KEY_ERROR_CODE, KEY_ERROR_PARAMS, KickUser, LeaveRoom, Login, Logout, ManualDisconnection, ModeratorMessage, ObjectMessage, PingPong, PlayerToSpectator, PrivateMessage, PublicMessage, QuickJoinGame, QuickJoinOrCreateRoom, RemoveBuddy, SetBuddyVariables, SetRoomVariables, SetUserPosition, SetUserVariables, SpectatorToPlayer, SubscribeRoomGroup, UnsubscribeRoomGroup
-
-
Constructor Summary
Constructors Constructor Description FindRoomsRequest(MatchExpression expr)
FindRoomsRequest(MatchExpression expr, java.lang.String groupId)
FindRoomsRequest(MatchExpression expr, java.lang.String groupId, short limit)
Creates a new FindRoomsRequest instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute(ISmartFox sfs)
* API internal usage only *void
validate(ISmartFox sfs)
* API internal usage only *-
Methods inherited from class sfs2x.client.requests.BaseRequest
getId, getMessage, getTargetController, isEncrypted, setEncrypted, setId, setTargetController
-
-
-
-
Field Detail
-
KEY_EXPRESSION
public static final java.lang.String KEY_EXPRESSION
* API internal usage only *- See Also:
- Constant Field Values
-
KEY_GROUP
public static final java.lang.String KEY_GROUP
* API internal usage only *- See Also:
- Constant Field Values
-
KEY_LIMIT
public static final java.lang.String KEY_LIMIT
* API internal usage only *- See Also:
- Constant Field Values
-
KEY_FILTERED_ROOMS
public static final java.lang.String KEY_FILTERED_ROOMS
* API internal usage only *- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FindRoomsRequest
public FindRoomsRequest(MatchExpression expr, java.lang.String groupId, short limit)
Creates a new FindRoomsRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.- Parameters:
expr
- A matching expression that the system will use to retrieve the Rooms.groupId
- The name of the Group where to search for matching Rooms; ifnull
, the search is performed in the whole Zone.limit
- The maximum size of the list of Rooms that will be returned by the roomFindResult event. If0
, all the found Rooms are returned.- See Also:
SmartFox.send(sfs2x.client.requests.IRequest)
,SFSEvent.ROOM_FIND_RESULT
-
FindRoomsRequest
public FindRoomsRequest(MatchExpression expr, java.lang.String groupId)
-
FindRoomsRequest
public FindRoomsRequest(MatchExpression expr)
-
-