public class SFSBuddyVariable extends java.lang.Object implements BuddyVariable
BuddyVariables support basic data types and nested complex objects:
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.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
name |
protected VariableType |
type |
protected java.lang.Object |
value |
| Modifier | Constructor and Description |
|---|---|
protected |
SFSBuddyVariable() |
|
SFSBuddyVariable(java.lang.String name,
java.lang.Object value) |
protected |
SFSBuddyVariable(java.lang.String name,
java.lang.Object value,
VariableType type) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone() |
java.lang.Boolean |
getBoolValue()
Get the value of the variable as Boolean
|
java.lang.Double |
getDoubleValue()
Get the value of the variable as Double
|
java.lang.Integer |
getIntValue()
Get the value of the variable as Integer
|
java.lang.String |
getName() |
ISFSArray |
getSFSArrayValue()
Get the value of the variable as SFSArray
|
ISFSObject |
getSFSObjectValue()
Get the value of the variable as SFSObject
|
java.lang.String |
getStringValue()
Get the value of the variable as String
|
VariableType |
getType()
Return the data type of the variable
|
java.lang.Object |
getValue()
Get the value of the variable as Object
|
boolean |
isNull()
Test if a variable is null
|
boolean |
isOffline()
Checks if this is a "offline" variable (persistent), which is available to other Users even when the
client is not online.
|
static SFSBuddyVariable |
newFromSFSArray(ISFSArray array)
SFSArray is expected to be formatted as follows
0: (str) - name
1: (byte) - type id
2: (*) - value
|
protected void |
populateArrayWithValue(ISFSArray sfsa)
Populate an SFSArray wih the typed value of this Variable
|
protected void |
setNull() |
protected void |
setValue(java.lang.Boolean val) |
protected void |
setValue(java.lang.Double val) |
protected void |
setValue(java.lang.Integer val) |
protected void |
setValue(ISFSArray val) |
protected void |
setValue(ISFSObject val) |
protected void |
setValue(java.lang.Object val) |
protected void |
setValue(java.lang.String val) |
protected void |
setValueFromStringLiteral(VariableType type,
java.lang.String literal) |
ISFSArray |
toSFSArray()
Private
|
java.lang.String |
toString() |
protected java.lang.String name
protected java.lang.Object value
protected VariableType type
public SFSBuddyVariable(java.lang.String name,
java.lang.Object value)
protected SFSBuddyVariable()
protected SFSBuddyVariable(java.lang.String name,
java.lang.Object value,
VariableType type)
public static SFSBuddyVariable newFromSFSArray(ISFSArray array)
array - protected void setValueFromStringLiteral(VariableType type, java.lang.String literal)
public boolean isOffline()
BuddyVariableisOffline in interface BuddyVariablepublic VariableType getType()
VariablegetType in interface VariableVariableTypepublic java.lang.Boolean getBoolValue()
VariablegetBoolValue in interface Variablepublic java.lang.Double getDoubleValue()
VariablegetDoubleValue in interface Variablepublic java.lang.Integer getIntValue()
VariablegetIntValue in interface Variablepublic ISFSArray getSFSArrayValue()
VariablegetSFSArrayValue in interface Variablepublic ISFSObject getSFSObjectValue()
VariablegetSFSObjectValue in interface Variablepublic java.lang.String getStringValue()
VariablegetStringValue in interface Variablepublic java.lang.Object getValue()
Variablepublic boolean isNull()
Variableprotected void setNull()
protected void setValue(java.lang.Boolean val)
protected void setValue(java.lang.Double val)
protected void setValue(java.lang.Integer val)
protected void setValue(ISFSArray val)
protected void setValue(ISFSObject val)
protected void setValue(java.lang.Object val)
public ISFSArray toSFSArray()
VariabletoSFSArray in interface Variableprotected void populateArrayWithValue(ISFSArray sfsa)
sfsa - the SFSArrayprotected void setValue(java.lang.String val)
public java.lang.Object clone()
clone in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object