View source

class thx.AnonymousMap<V> implements IMap<String, V>

Available on all platforms

IMap wrapper for anonymous objects. It allows to use anonymous objects as sources for IMap without the need of explicitely extracting all of its values.

var map = new AnonymousMap({ a : "A", b : "B" });
trace(map.get("a"));

The API is exactly the same for Map<TKey, TValue>.

Instance Fields

Toggle inherited fields

function exists(k:String):Bool

It returns true if the object contains a field with key k.

function get(k:String):Null<V>

It gets the value at the specified key.

inline function getObject():{}

getObject returns the undetlying anonymous object.

function iterator():Iterator<V>

It returns an iterator of values in the object.

function keys():Iterator<String>

It returns an iterator of strings containing all the field keys in the object.

function new(o:{}):Void

Creates an instance of IMap<String, V> (AnonymousMap<V>) out of an anonymous object.

Note that using this class any operation that is expected to change the state of the Map is going to change the state of the underlying anonymous object.

function remove(k:String):Bool

It removes the field k from the underlying obejct. The function returns true if the removal was successful.

function set(k:String, v:V):Void

It sets the value at the specified key.

function toString():String

It returns a string representation of the object.