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()
BuddyVariable
isOffline
in interface BuddyVariable
public VariableType getType()
Variable
getType
in interface Variable
VariableType
public java.lang.Boolean getBoolValue()
Variable
getBoolValue
in interface Variable
public java.lang.Double getDoubleValue()
Variable
getDoubleValue
in interface Variable
public java.lang.Integer getIntValue()
Variable
getIntValue
in interface Variable
public ISFSArray getSFSArrayValue()
Variable
getSFSArrayValue
in interface Variable
public ISFSObject getSFSObjectValue()
Variable
getSFSObjectValue
in interface Variable
public java.lang.String getStringValue()
Variable
getStringValue
in interface Variable
public java.lang.Object getValue()
Variable
public boolean isNull()
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)
public ISFSArray toSFSArray()
Variable
toSFSArray
in interface Variable
protected void populateArrayWithValue(ISFSArray sfsa)
sfsa
- the SFSArray
protected void setValue(java.lang.String val)
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object