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 InvitationfromSFSArray(ISFSArray sfsa)InvitationCallbackgetCallback()Obtain a reference to the CallBack handler classintgetExpiryTime()The expiration timestamp.intgetId()Get the unique invitation IDUsergetInvitee()Get the Invitee, the user that receives the invitationUsergetInviter()Get the Inviter, the user that started this invitationISFSObjectgetParams()An SFSObject of custom parameters can be attached to the invitation.intgetSecondsForAnswer()The amount of seconds given to the invitee to respond to the invitationbooleanisExpired()Checks if the invitation is expired.voidsetCallback(InvitationCallback callback)Set the CallBack handler for the invitation.voidsetParams(ISFSObject params)An SFSObject of custom parameters can be attached to the invitation.java.lang.StringtoString()
-
-
-
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:InvitationGet the unique invitation ID- Specified by:
getIdin interfaceInvitation- Returns:
- the id
-
getParams
public ISFSObject getParams()
Description copied from interface:InvitationAn 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:
getParamsin interfaceInvitation- Returns:
- the custom parameters
- See Also:
SFSObject
-
setParams
public void setParams(ISFSObject params)
Description copied from interface:InvitationAn 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:
setParamsin interfaceInvitation- Parameters:
params- the custom parameters- See Also:
SFSObject
-
getInviter
public User getInviter()
Description copied from interface:InvitationGet the Inviter, the user that started this invitation- Specified by:
getInviterin interfaceInvitation- Returns:
- the inviter
-
getInvitee
public User getInvitee()
Description copied from interface:InvitationGet the Invitee, the user that receives the invitation- Specified by:
getInviteein interfaceInvitation- Returns:
- the invitee
-
getExpiryTime
public int getExpiryTime()
Description copied from interface:InvitationThe expiration timestamp.- Specified by:
getExpiryTimein interfaceInvitation- Returns:
- expiration timestamp.
-
isExpired
public boolean isExpired()
Description copied from interface:InvitationChecks if the invitation is expired.- Specified by:
isExpiredin interfaceInvitation- Returns:
- true if the invitation is expired
-
getSecondsForAnswer
public int getSecondsForAnswer()
Description copied from interface:InvitationThe amount of seconds given to the invitee to respond to the invitation- Specified by:
getSecondsForAnswerin interfaceInvitation- Returns:
- the amount of seconds given to the invitee to respond to the invitation
-
getCallback
public InvitationCallback getCallback()
Description copied from interface:InvitationObtain a reference to the CallBack handler class- Specified by:
getCallbackin interfaceInvitation- Returns:
- the callback handler
- See Also:
InvitationCallback
-
setCallback
public void setCallback(InvitationCallback callback)
Description copied from interface:InvitationSet 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:
setCallbackin interfaceInvitation- Parameters:
callback- the callback handler- See Also:
InvitationCallback
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-