Package | com.ericfeminella.collections |
Class | public class LocalPersistenceMap |
Implements | IMap |
IMap
implementation into the data
object of a SharedObject
on a clients local file system.
LocalPersistenceMap
allows the data
object
of a SharedObject
to be accessed via an IMap
implementation in order to provide a consistant API for working with
the underlying data of the SharedObject
.
LocalPersistenceMap
can be utilized to provide a typical
IMap
implementation into a SharedObject
.
var map:IMap = new LocalPersistenceMap("test", "/"); map.put("username", "efeminella"); map.put("password", "43kj5k4nr43r934hcr34hr8h3"); map.put("admin", true);
See also
Property | Defined by | ||
---|---|---|---|
sharedObjectInstance : SharedObject [read-only]
Retrieves the underlying
SharedObject instance
used by the LocalPersistenceMap . | LocalPersistenceMap |
Property | Defined by | ||
---|---|---|---|
minimumStorage : Number
Defines the minimum disc space which is required by the persistant
SharedObject . | LocalPersistenceMap | ||
sharedObject : SharedObject
Defines the underlying
SharedObject instance in which
the persistant data is stored. | LocalPersistenceMap |
Method | Defined by | ||
---|---|---|---|
LocalPersistenceMap(identifier:String, localPath:String = null, secure:Boolean = false, minimumStorage:int = 500)
SharedObject available from the clients
local disk. | LocalPersistenceMap | ||
clear():void
Resets all key / values in the
data object of the
underlying the SharedObject instance to null. | LocalPersistenceMap | ||
clearAllExcept(key:*):void
Clears all key / values defined in the
data object
of the underlying the SharedObject instance with the
exception of the specified key. | LocalPersistenceMap | ||
containsKey(key:*):Boolean
Determines if a key exists in the
data object of the
underlying the SharedObject instance. | LocalPersistenceMap | ||
containsValue(value:*):Boolean
Determines if a value exists in the HashMap instance
| LocalPersistenceMap | ||
getEntries():IList
Returns an
IList of IHashMapEntry
objects based on the underlying internal map. | LocalPersistenceMap | ||
getKey(value:*):*
Returns a key value from the HashMap instance
| LocalPersistenceMap | ||
getKeys():Array
Returns each key added to the
data object of the
underlying the SharedObject instance. | LocalPersistenceMap | ||
getValue(key:*):*
Returns each key added to the
data object of the
underlying the SharedObject instance. | LocalPersistenceMap | ||
getValues():Array
Retrieves each value assigned to the
data object of
the underlying the SharedObject instance. | LocalPersistenceMap | ||
isEmpty():Boolean
Determines if the current
data object of the
underlying the SharedObject instance is empty. | LocalPersistenceMap | ||
put(key:*, value:*):void
Adds a key and value to the
data object of the
underlying the SharedObject instance. | LocalPersistenceMap | ||
putAll(table:Dictionary):void
[new]
putAll places all name / value pairs defined in an Object or Dictionary instance into the SharedObject instance. | LocalPersistenceMap | ||
putEntry(entry:IHashMapEntry):void
[new]
putEntry is intended as a pseudo-overloaded
put implementation whereby clients may call
putEntry to pass an IHashMapEntry
implementation. | LocalPersistenceMap | ||
remove(key:*):void
Removes a key and value from the
data object of the
underlying the SharedObject instance. | LocalPersistenceMap | ||
reset():void
Resets all key / value assignment in the
data object
of the underlying the SharedObject instance is empty
to null. | LocalPersistenceMap | ||
resetAllExcept(key:*):void
Resets all key / values defined in the
data object of
the underlying the SharedObject instance is empty to
null with the exception of the specified key. | LocalPersistenceMap | ||
size():int
Determines the size of the
data object of the
underlying the SharedObject instance.e
| LocalPersistenceMap |
Method | Defined by | ||
---|---|---|---|
stripInvalidChars(identifier:String):String
[static]
Removes invalid charachters from a
SharedObject name
and substitutes the invalid charachters with an underscore. | LocalPersistenceMap |
minimumStorage | property |
protected var minimumStorage:Number
Defines the minimum disc space which is required by the persistant
SharedObject
.
sharedObject | property |
protected var sharedObject:SharedObject
Defines the underlying SharedObject
instance in which
the persistant data
is stored.
sharedObjectInstance | property |
sharedObjectInstance:SharedObject
[read-only]
Retrieves the underlying SharedObject
instance
used by the LocalPersistenceMap
.
public function get sharedObjectInstance():SharedObject
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var map:LocalPersistenceMap = new LocalPersistenceMap("sharedObjectName"); trace( map.sharedObjectInstance );
LocalPersistenceMap | () | constructor |
public function LocalPersistenceMap(identifier:String, localPath:String = null, secure:Boolean = false, minimumStorage:int = 500)
SharedObject
available from the clients
local disk. If the SharedObject
does not currently exist,
Flash Player will attempt to created it.
If the identifier parameter contains any invalid charachters, they will be substituted with underscores
Parametersidentifier:String — name of the local SharedObject
|
|
localPath:String (default = null ) — the local path to the SharedObject
|
|
secure:Boolean (default = false ) — specifies if the shared object is from a secure domain
|
|
minimumStorage:int (default = 500 ) — minimum amount of disc space required by the shared object
|
clear | () | method |
public function clear():void
Resets all key / values in the data
object of the
underlying the SharedObject
instance to null.
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var map:IMap = new LocalPersistenceMap("sharedObjectName"); map.put( "admin", adminVO ); map.put( "editor", editorVO ); trace( map.size() ); //2 map.clear(); trace( map.size() ); //0
clearAllExcept | () | method |
public function clearAllExcept(key:*):void
Clears all key / values defined in the data
object
of the underlying the SharedObject
instance with the
exception of the specified key.
key:* — key which is not to be cleared from the map
|
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var map:IMap = new LocalPersistenceMap("sharedObjectName"); map.put( "admin", adminVO ); map.put( "editor", editorVO ); trace( map.size() ); //2 map.clearAllExcept( "editor", editorVO ); trace( map.getValues() ); //[object, editorVO] trace( map.size() ); //1
containsKey | () | method |
public function containsKey(key:*):Boolean
Determines if a key exists in the data
object of the
underlying the SharedObject
instance.
key:* — the key in which to determine existance in the map
|
Boolean — true if the key exisits, false if not
|
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var map:IMap = new LocalPersistenceMap("sharedObjectName"); map.put( "admin", adminVO ); trace( map.containsKey( "admin" ) ); //true
containsValue | () | method |
public function containsValue(value:*):Boolean
Determines if a value exists in the HashMap instance
Parametersvalue:* — the value in which to determine existance in the map
|
Boolean — true if the value exisits, false if not
|
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var map:IMap = new LocalPersistenceMap("sharedObjectName"); map.put( "admin", adminVO ); trace( map.containsValue( adminVO ) ); //true
getEntries | () | method |
public function getEntries():IList
Returns an IList
of IHashMapEntry
objects based on the underlying internal map.
IList |
getKey | () | method |
public function getKey(value:*):*
Returns a key value from the HashMap instance
Parametersvalue:* — the key in which to retrieve the value of
|
String — the value of the specified key
|
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var map:IMap = new LocalPersistenceMap("sharedObjectName"); map.put( "admin", adminVO ); trace( map.getKey( adminVO ) ); //admin
getKeys | () | method |
public function getKeys():Array
Returns each key added to the data
object of the
underlying the SharedObject
instance.
Array — Array of key identifiers
|
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var map:IMap = new LocalPersistenceMap("sharedObjectName"); map.put( "admin", adminVO ); map.put( "editor", editorVO ); trace( map.getKeys() ); //admin, editor
getValue | () | method |
public function getValue(key:*):*
Returns each key added to the data
object of the
underlying the SharedObject
instance.
key:* |
* — Array of key identifiers
|
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var map:IMap = new LocalPersistenceMap("sharedObjectName"); map.put( "admin", adminVO ); map.put( "editor", editorVO ); trace( map.getKeys() ); //admin, editor
getValues | () | method |
public function getValues():Array
Retrieves each value assigned to the data
object of
the underlying the SharedObject
instance.
Array — Array of values assigned for all keys in the map
|
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var map:IMap = new LocalPersistenceMap("sharedObjectName"); map.put( "admin", adminVO ); map.put( "editor", editorVO ); trace( map.getValues() ); //[object, adminVO],[object, editorVO]
isEmpty | () | method |
public function isEmpty():Boolean
Determines if the current data
object of the
underlying the SharedObject
instance is empty.
Boolean — true if the current map is empty, false if not
|
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var map:IMap = new LocalPersistenceMap("sharedObjectName"); trace( map.isEmpty() ); //true map.put( "admin", adminVO ); trace( map.isEmpty() ); //false
put | () | method |
public function put(key:*, value:*):void
Adds a key and value to the data
object of the
underlying the SharedObject
instance.
key:* — key to add to the map
|
|
value:* — value of the specified key
|
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var map:IMap = new LocalPersistenceMap("sharedObjectName"); map.put( "user", userVO );
putAll | () | method |
public function putAll(table:Dictionary):void
Places all name / value pairs into the current
IMap
instance.
table:Dictionary — Object of name / value pairs
|
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var table:Object = {a: "foo", b: "bar"}; var map:IMap = new LocalPersistenceMap("sharedObjectName"); map.putAll( table ); trace( map.getKeys() ); // a, b trace( map.getValues() ); // foo, bar
putEntry | () | method |
public function putEntry(entry:IHashMapEntry):void
putEntry
is intended as a pseudo-overloaded
put
implementation whereby clients may call
putEntry
to pass an IHashMapEntry
implementation.
entry:IHashMapEntry — IHashMapEntry implementation
|
remove | () | method |
public function remove(key:*):void
Removes a key and value from the data
object of the
underlying the SharedObject
instance.
key:* — key to remove from the map
|
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var map:IMap = new LocalPersistenceMap("sharedObjectName"); map.put( "admin", adminVO ); map.remove( "admin" );
reset | () | method |
public function reset():void
Resets all key / value assignment in the data
object
of the underlying the SharedObject
instance is empty
to null.
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var map:IMap = new LocalPersistenceMap("sharedObjectName"); map.put( "admin", adminVO ); map.put( "editor", editorVO ); map.reset(); trace( map.getValues() ); //null, null
resetAllExcept | () | method |
public function resetAllExcept(key:*):void
Resets all key / values defined in the data
object of
the underlying the SharedObject
instance is empty to
null with the exception of the specified key.
key:* — key which is not to be cleared from the map
|
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var map:IMap = new LocalPersistenceMap("sharedObjectName"); map.put( "admin", adminVO ); map.put( "editor", editorVO ); trace( map.getValues() ); //[object, adminVO],[object, editorVO] map.resetAllExcept( "editor", editorVO ); trace( map.getValues() ); //null, [object, editorVO]
size | () | method |
public function size():int
Determines the size of the data
object of the
underlying the SharedObject
instance.e
int — the current size of the map instance
|
import com.ericfeminella.collections.LocalPersistenceMap; import com.ericfeminella.collections.IMap; var map:IMap = new LocalPersistenceMap("sharedObjectName"); map.put( "admin", adminVO ); map.put( "editor", editorVO ); trace( map.size() ); //2
stripInvalidChars | () | method |
protected static function stripInvalidChars(identifier:String):String
Removes invalid charachters from a SharedObject
name
and substitutes the invalid charachters with an underscore.
identifier:String |
String — a valid SharedObject name
|