it.gotoandplay.smartfoxclient.data
Class SFSObject

java.lang.Object
  extended by it.gotoandplay.smartfoxclient.data.SFSObject

public class SFSObject
extends java.lang.Object

Author:
Lapo

Constructor Summary
SFSObject()
          Default constructor
SFSObject(java.util.Collection collection)
          Constructs the ActionscriptObject populating it with the passed collection
SFSObject(java.util.Map map)
          Constructs the ActionscriptObject populating it with the passed map
 
Method Summary
 java.lang.Object get(int key)
          Get an object from an index key
 java.lang.Object get(java.lang.String key)
          Get an object from a string key
 boolean getBool(int key)
          Get a boolean from an index key
 boolean getBool(java.lang.String key)
          Get a boolean from a String key
 double getNumber(int key)
          Get a number from an index key
 double getNumber(java.lang.String key)
          Get a number from a string key
 SFSObject getObj(int key)
          Get an ActionscriptObject from an index key
 SFSObject getObj(java.lang.String key)
          Get an ActionscriptObject from a string key
 java.lang.String getString(int key)
          Get a String from and index key
 java.lang.String getString(java.lang.String key)
          Get a String from a string key
 java.util.Set keySet()
          Get a Set of keys
 void put(int key, java.lang.Object o)
          Put an object with a numeric key (Indexed Array)
 void put(java.lang.String key, java.lang.Object o)
          Put an object with a String key (Associative Array)
 void putBool(int key, boolean b)
          Put a Boolean value with a numeric key (Indexed Array)
 void putBool(java.lang.String key, boolean b)
          Put a Boolean value with a string key (Indexed Array)
 void putCollection(int key, java.util.Collection collection)
          Adds the content of a Collection, which may also include other collections or maps
 void putCollection(java.lang.String key, java.util.Collection collection)
          Adds the content of a Collection, which may also include other collections or maps
 void putMap(int key, java.util.Map map)
          Add the content of a Map, which can also contain other maps or collections
 void putMap(java.lang.String key, java.util.Map map)
          Add the content of a Map, which can also contain other maps or collections
 void putNumber(int key, double d)
          Put a Number with a numeric key (Indexed Array)
 void putNumber(java.lang.String key, double d)
          Put a Number with a string key (Associative Array)
 java.lang.Object removeElement(int key)
          Remove an element
 java.lang.Object removeElement(java.lang.String key)
          Remove an element
 int size()
          Get the current number of elements
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SFSObject

public SFSObject()
Default constructor


SFSObject

public SFSObject(java.util.Collection collection)
Constructs the ActionscriptObject populating it with the passed collection

Parameters:
collection - a Collection

SFSObject

public SFSObject(java.util.Map map)
Constructs the ActionscriptObject populating it with the passed map

Parameters:
map - a Map
Method Detail

put

public void put(java.lang.String key,
                java.lang.Object o)
Put an object with a String key (Associative Array)

Parameters:
key - the string key
o - the object

put

public void put(int key,
                java.lang.Object o)
Put an object with a numeric key (Indexed Array)

Parameters:
key - the index key
o - the object

putNumber

public void putNumber(int key,
                      double d)
Put a Number with a numeric key (Indexed Array)

Parameters:
key - the index key
d - the number (treated as double)

putNumber

public void putNumber(java.lang.String key,
                      double d)
Put a Number with a string key (Associative Array)

Parameters:
key - the string key
d - the number (treated as double)

putBool

public void putBool(int key,
                    boolean b)
Put a Boolean value with a numeric key (Indexed Array)

Parameters:
key - the index key
b - the boolean

putBool

public void putBool(java.lang.String key,
                    boolean b)
Put a Boolean value with a string key (Indexed Array)

Parameters:
key - the string key
b - the boolean

get

public java.lang.Object get(java.lang.String key)
Get an object from a string key

Parameters:
key - the string key
Returns:
the object

get

public java.lang.Object get(int key)
Get an object from an index key

Parameters:
key - the key
Returns:
the object

getString

public java.lang.String getString(int key)
Get a String from and index key

Parameters:
key - the key
Returns:
the string

getString

public java.lang.String getString(java.lang.String key)
Get a String from a string key

Parameters:
key - the key
Returns:
the string

getNumber

public double getNumber(int key)
Get a number from an index key

Parameters:
key - the key
Returns:
the number (as double)

getNumber

public double getNumber(java.lang.String key)
Get a number from a string key

Parameters:
key - the key
Returns:
the number (as double)

getBool

public boolean getBool(int key)
Get a boolean from an index key

Parameters:
key - the key
Returns:
the boolean

getBool

public boolean getBool(java.lang.String key)
Get a boolean from a String key

Parameters:
key - the key
Returns:
the boolean

getObj

public SFSObject getObj(int key)
Get an ActionscriptObject from an index key

Parameters:
key - the index key
Returns:
the ActionscriptObject

getObj

public SFSObject getObj(java.lang.String key)
Get an ActionscriptObject from a string key

Parameters:
key - the key
Returns:
the ActionscriptObject

size

public int size()
Get the current number of elements

Returns:
the current size

keySet

public java.util.Set keySet()
Get a Set of keys

Returns:
the key set

removeElement

public java.lang.Object removeElement(int key)
Remove an element

Parameters:
key - the index key
Returns:
the element removed

removeElement

public java.lang.Object removeElement(java.lang.String key)
Remove an element

Parameters:
key - the string key
Returns:
the element removed

putCollection

public void putCollection(java.lang.String key,
                          java.util.Collection collection)
Adds the content of a Collection, which may also include other collections or maps

Parameters:
key - the String key
collection - the Collection
Since:
1.6.0

putCollection

public void putCollection(int key,
                          java.util.Collection collection)
Adds the content of a Collection, which may also include other collections or maps

Parameters:
key - the numeric key
collection - the Collection
Since:
1.6.0

putMap

public void putMap(java.lang.String key,
                   java.util.Map map)
Add the content of a Map, which can also contain other maps or collections

Parameters:
key - the String key
map - the Map object
Since:
1.6.0

putMap

public void putMap(int key,
                   java.util.Map map)
Add the content of a Map, which can also contain other maps or collections

Parameters:
key - the numeric key
map - the Map object
Since:
1.6.0

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object