Class
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 Summary

Attributes Name and Description
caplin.trading.trademodel.DataHolder(Object mMap)

Creates an instance of caplin.trading.trademodel.DataHolder.

Method Summary

Attributes Name and Description
void append(caplin.trading.trademodel.DataHolder oToAdd, String sPrefix)

Extracts all data from the supplied DataHolder and appends it to this instance.

caplin.trading.trademodel.DataHolder clone(String sPrefix)

Returns a copy of this object.

String get(String sName)

Returns the data value with the specified name.

Object getDataAsMap()

Returns the data as a name/value pair map.

Array getFieldNames()

Returns an array of the names of all stored values.

Object getNonSeparated(String sSeparator)

Returns the data field pairs that do not contain the specified separator.

Object getPrefixed(String sPrefix)

Returns the values with names which match the requested prefix.

void set(String sName, String sValue)

Stores the value using the provided name.

Constructor Detail

caplin.trading.trademodel.DataHolder(Object mMap)

Creates an instance of caplin.trading.trademodel.DataHolder.

Parameters
Object mMap If supplied, the DataHolder is initialised with the given map (Optional).

Method Detail

void append(caplin.trading.trademodel.DataHolder oToAdd, String sPrefix)

Extracts all data from the supplied DataHolder and appends it to this instance. Overwrites any existing values with the same name.

Parameters
caplin.trading.trademodel.DataHolder oToAdd The DataHolder whose data will be appended to this DataHolder.
String sPrefix A prefix used to prepend to the appended field names. If no prefix is specified, the field names are not prefixed.

caplin.trading.trademodel.DataHolder clone(String sPrefix)

Returns a copy of this object.

Parameters
String sPrefix The prefix that will be prepended to all the field names within the original data holder.

String get(String sName)

Returns the data value with the specified name.

Parameters
String sName The name of value to return.
See
#set

Object getDataAsMap()

Returns the data as a name/value pair map.

Array getFieldNames()

Returns an array of the names of all stored values.

Returns
An array of field names as strings.

Object getNonSeparated(String sSeparator)

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
String sSeparator The separator to check for.
Returns
The data field name/value pairs.

Object getPrefixed(String sPrefix)

Returns the values with names which match the requested prefix.

Parameters
String sPrefix The prefix of the requested data fields.
Returns
A map of the requested fields (names are un-prefixed).

void set(String sName, String sValue)

Stores the value using the provided name.

Parameters
String sName The name of the data field.
String sValue The value to be stored.
See
#get