Package com.smartfoxserver.buddylist
Class SFSBuddyVariable
java.lang.Object
com.smartfoxserver.entities.variables.BaseVariable
com.smartfoxserver.buddylist.SFSBuddyVariable
- All Implemented Interfaces:
BuddyVariable,Variable,Serializable,Cloneable
public class SFSBuddyVariable
extends com.smartfoxserver.entities.variables.BaseVariable
implements BuddyVariable
BuddyVariables are custom values attached to any Buddy in a BuddyList. They work with the same principle of the User/Room Variables.
The only difference is the logic by which they get propagated to other Users. While RoomVariables are broadcast to all clients in the same Room, BuddyVariables
are updated to all Users who have the BuddyVariable owner in their BuddyLists.
BuddyVariables support basic data types and nested complex objects:
- Null
- Bool
- Int
- Double
- String
- SFSObject
- SFSArray
Also BuddyVariables provide a special convention that allows certain variables to be "seen" to the other Users even when they are not online. All variable names starting with a dollar sign ($) will be persistent and available at any time whether the owner is online or not.
- See Also:
-
Field Summary
FieldsFields inherited from class com.smartfoxserver.entities.variables.BaseVariable
name, type, value -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSFSBuddyVariable(String name, Object value) protectedSFSBuddyVariable(String name, Object value, VariableType type) -
Method Summary
Modifier and TypeMethodDescriptionclone()booleanChecks if this is a "offline" variable (persistent), which is available to other Users even when the client is not online.static SFSBuddyVariablenewFromSFSArray(ISFSArray array) SFSArray is expected to be formatted as follows 0: (str) - name 1: (byte) - type id 2: (*) - valuetoString()Methods inherited from class com.smartfoxserver.entities.variables.BaseVariable
getBoolValue, getByteValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getName, getSFSArrayValue, getSFSObjectValue, getShortValue, getStringValue, getType, getValue, getVector2Value, getVector3Value, isNull, populateArrayWithValue, setNull, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueFromStringLiteralMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.smartfoxserver.entities.variables.Variable
getBoolValue, getByteValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getName, getSFSArrayValue, getSFSObjectValue, getShortValue, getStringValue, getType, getValue, getVector2Value, getVector3Value, isNull
-
Field Details
-
OFFLINE_PREFIX
- See Also:
-
-
Constructor Details
-
SFSBuddyVariable
-
SFSBuddyVariable
protected SFSBuddyVariable() -
SFSBuddyVariable
-
-
Method Details
-
newFromSFSArray
SFSArray is expected to be formatted as follows 0: (str) - name 1: (byte) - type id 2: (*) - value- Parameters:
array-- Returns:
- the RoomVariable
-
isOffline
public boolean isOffline()Description copied from interface:BuddyVariableChecks if this is a "offline" variable (persistent), which is available to other Users even when the client is not online.- Specified by:
isOfflinein interfaceBuddyVariable- Returns:
- true if the variable is persistent
-
toSFSArray
- Specified by:
toSFSArrayin interfaceVariable
-
clone
-
toString
-