Caplin Trader 4.8.0

Class: module:caplin/trading/trademodel/DataHolder

module:caplin/trading/trademodel/DataHolder

Holds data as name/value pairs, providing utility methods for accessing and manipulating the data.

n.b.: the map passed in is used as the internal data structure. Changing the original map after construction will change the internal state of the DataHolder.

Constructor

new module:caplin/trading/trademodel/DataHolder(mMapopt)

Creates an instance of caplin.trading.trademodel.DataHolder.
Parameters:
Name Type Attributes Description
mMap Object <optional>
If supplied, the DataHolder is initialised with the given map

Methods

append(sourceDataHolder, prefix)

Extracts all data from the supplied DataHolder and appends it to this instance. Overwrites any existing values with the same name.
Parameters:
Name Type Description
sourceDataHolder module:caplin/trading/trademodel/DataHolder The DataHolder whose data will be appended to this DataHolder.
prefix String A prefix used to prepend to the appended field names. If no prefix is specified, the field names are not prefixed.

clone(prefix)

Returns a copy of this object.
Parameters:
Name Type Description
prefix String The prefix that will be prepended to all the field names within the original data holder.

get(name)

Returns the data value with the specified name.
Parameters:
Name Type Description
name String The name of value to return.
See:

getDataAsMap()

Returns the data as a name/value pair map.

getFieldNames() → {Array}

Returns an array of the names of all stored values.
Returns:
An array of field names as strings.
Type
Array

getNonSeparated(separator) → {Object}

Returns the data field pairs that do not contain the specified separator. For example, the invocation oData.getNonSeparated("_") would only return the values that have names which do not contain an underscore.
Parameters:
Name Type Description
separator String The separator to check for.
Returns:
The data field name/value pairs.
Type
Object

getPrefixed(prefix) → {Object}

Returns the values with names which match the requested prefix.
Parameters:
Name Type Description
prefix String The prefix of the requested data fields.
Returns:
A map of the requested fields (names are un-prefixed).
Type
Object

set(name, value)

Stores the value using the provided name.
Parameters:
Name Type Description
name String The name of the data field.
value String The value to be stored.
See: