Class SFSInvitation
- java.lang.Object
-
- com.smartfoxserver.v2.entities.invitation.SFSInvitation
-
- All Implemented Interfaces:
Invitation
public class SFSInvitation extends java.lang.Object implements Invitation
Overview
An Invitation object provides the ability to send a generic invitation for a specific event going on in your application, be it a game, visiting a personal room or another location of the virtual world etc...The SFS2X Invitation Manager is very simple to use. All you need to provide is:
- inviter: the User starting the invitation (null == Server)
- invitee: the User to invite
- expiryTime: the amount of time (in seconds) that the invitee has to accept/refuse the invitation. (default is 15 sec)
- params: any custom params to send with the invitation (e.g. a message, game name etc...)
InvitationCallback
.
-
-
Constructor Summary
Constructors Constructor Description SFSInvitation(User inviter, User invitee, int secondsForAnswer)
SFSInvitation(User inviter, User invitee, int secondsForAnswer, ISFSObject params)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Invitation
fromSFSArray(ISFSArray sfsa)
InvitationCallback
getCallback()
Obtain a reference to the CallBack handler classint
getExpiryTime()
The expiration timestamp.int
getId()
Get the unique invitation IDUser
getInvitee()
Get the Invitee, the user that receives the invitationUser
getInviter()
Get the Inviter, the user that started this invitationISFSObject
getParams()
An SFSObject of custom parameters can be attached to the invitation.int
getSecondsForAnswer()
The amount of seconds given to the invitee to respond to the invitationboolean
isExpired()
Checks if the invitation is expired.void
setCallback(InvitationCallback callback)
Set the CallBack handler for the invitation.void
setParams(ISFSObject params)
An SFSObject of custom parameters can be attached to the invitation.java.lang.String
toString()
-
-
-
Constructor Detail
-
SFSInvitation
public SFSInvitation(User inviter, User invitee, int secondsForAnswer, ISFSObject params)
-
-
Method Detail
-
fromSFSArray
public static Invitation fromSFSArray(ISFSArray sfsa)
-
getId
public int getId()
Description copied from interface:Invitation
Get the unique invitation ID- Specified by:
getId
in interfaceInvitation
- Returns:
- the id
-
getParams
public ISFSObject getParams()
Description copied from interface:Invitation
An SFSObject of custom parameters can be attached to the invitation. It could contain any properties relevant to the invitation, like a message, the game type/settings and any other parameter.- Specified by:
getParams
in interfaceInvitation
- Returns:
- the custom parameters
- See Also:
SFSObject
-
setParams
public void setParams(ISFSObject params)
Description copied from interface:Invitation
An SFSObject of custom parameters can be attached to the invitation. It could contain any properties relevant to the invitation, like a message, the game type/settings and any other parameter.- Specified by:
setParams
in interfaceInvitation
- Parameters:
params
- the custom parameters- See Also:
SFSObject
-
getInviter
public User getInviter()
Description copied from interface:Invitation
Get the Inviter, the user that started this invitation- Specified by:
getInviter
in interfaceInvitation
- Returns:
- the inviter
-
getInvitee
public User getInvitee()
Description copied from interface:Invitation
Get the Invitee, the user that receives the invitation- Specified by:
getInvitee
in interfaceInvitation
- Returns:
- the invitee
-
getExpiryTime
public int getExpiryTime()
Description copied from interface:Invitation
The expiration timestamp.- Specified by:
getExpiryTime
in interfaceInvitation
- Returns:
- expiration timestamp.
-
isExpired
public boolean isExpired()
Description copied from interface:Invitation
Checks if the invitation is expired.- Specified by:
isExpired
in interfaceInvitation
- Returns:
- true if the invitation is expired
-
getSecondsForAnswer
public int getSecondsForAnswer()
Description copied from interface:Invitation
The amount of seconds given to the invitee to respond to the invitation- Specified by:
getSecondsForAnswer
in interfaceInvitation
- Returns:
- the amount of seconds given to the invitee to respond to the invitation
-
getCallback
public InvitationCallback getCallback()
Description copied from interface:Invitation
Obtain a reference to the CallBack handler class- Specified by:
getCallback
in interfaceInvitation
- Returns:
- the callback handler
- See Also:
InvitationCallback
-
setCallback
public void setCallback(InvitationCallback callback)
Description copied from interface:Invitation
Set the CallBack handler for the invitation. The handler will be invoked by the system when the invited User accepts or refuses the invitation or if the invitation expires.- Specified by:
setCallback
in interfaceInvitation
- Parameters:
callback
- the callback handler- See Also:
InvitationCallback
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-