Diffusion .NET Classic API - Core and Common  5.9.4
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
PushTechnology.DiffusionCore.Messaging.Record Class Reference

A message record. More...

Public Member Functions

 Record (IMRecord metadata, params string[] fields)
 
 Record (params string[] fields)
 Create a free-format record with zero or more fields. More...
 
void AddFields (params string[] fields)
 Adds one or more fields to the end of the record. More...
 
void AddFields< T > (ICollection< T > fields)
 Adds one or more fields to the end of the record. More...
 
void AddField (int index, string field)
 Inserts a field at a specified index within the record, moving subsequent fields along the record. More...
 
string RemoveField (int index)
 
void SetField (int index, string field)
 Replaces a field at a specified index within the record. More...
 
void SetField (string name, params object[] values)
 Set field value(s) by name. More...
 
void SetField (string name, int index, object value)
 Sets a field value by name and index. More...
 
void SetFieldValues< T > (string name, ICollection< T > values)
 As SetField( string, params string [] object ), but allowing a collection of values to be supplied. More...
 
int AppendToField (string name, params object[] values)
 Appends one or more values to a repeating field. More...
 
int AppendToField< T > (string name, ICollection< T > values)
 Appends one or more values to a repeating field. More...
 
string GetField (string name)
 Gets a field value by name. More...
 
string GetField (int index)
 Returns a specific field value within the record. More...
 
string GetField (string name, int index)
 Get the value of a specified occurrence of a repeating field. More...
 
List< string > GetFields ()
 Returns the values of all field occurrences within the record. More...
 
List< string > GetFieldValues (string name)
 Gets a list of field values. More...
 
List< object > GetMappedFields ()
 This returns the fields of the record in a format mapped to the record metadata. More...
 
int Size ()
 Returns the number of field values within the record. More...
 
int SizeInBytes ()
 Returns the number of bytes that this record would occupy in a DataMessage that uses the default character set for byte encoding. More...
 
int SizeInBytes (System.Text.Encoding encoding)
 Returns the number of bytes that this record would occupy in a DataMessage that uses a specified character set for byte endoing. More...
 
int SizeInChars ()
 Returns the total number of characters within this record (including delimiters). More...
 
override string ToString ()
 Returns the string representation of this object. More...
 

Properties

MRecordImpl MetaData [get, set]
 Metadata to initialise and police the data - may be null for free for all processing. More...
 

Detailed Description

A message record.

Constructor & Destructor Documentation

PushTechnology.DiffusionCore.Messaging.Record.Record ( IMRecord  metadata,
params string[]  fields 
)

Parameters
metadata
fields
PushTechnology.DiffusionCore.Messaging.Record.Record ( params string[]  fields)

Create a free-format record with zero or more fields.

Parameters
fieldsOptional variable-length number of field values.

Member Function Documentation

void PushTechnology.DiffusionCore.Messaging.Record.AddField ( int  index,
string  field 
)

Inserts a field at a specified index within the record, moving subsequent fields along the record.

This can only be used for free-format records (i.e. those without metadata).

Parameters
indexThe index to add a field at.
fieldThe field to add.
void PushTechnology.DiffusionCore.Messaging.Record.AddFields ( params string[]  fields)

Adds one or more fields to the end of the record.

This can only be used for free-format records (i.e. those without metadata).

Parameters
fieldsA list of fields to add.
void PushTechnology.DiffusionCore.Messaging.Record.AddFields< T > ( ICollection< T >  fields)

Adds one or more fields to the end of the record.

A collection of any type may be supplied and the ToString() value of each object will be used as the string value.

If any field value is null, it will be written as an empty field (i.e. a zero-length string).

This can only be used for free-format records (i.e. those without metadata).

Template Parameters
T
Parameters
fieldsThe collection of field objects to add.
int PushTechnology.DiffusionCore.Messaging.Record.AppendToField ( string  name,
params object[]  values 
)

Appends one or more values to a repeating field.

This can only be used for a record that has metadata and for a Multiplicity.IsRepeating multiplicity field.

Adding the values must not cause the Multiplicity.Maximum number of values to be exceeded.

Parameters
nameThe field name.
valuesThe value or values which are parsed according to the data type as specified in the metadata. If null or no values supplied then this call has no effect.
Returns
The number of values that the field has after the specified values have been added.
int PushTechnology.DiffusionCore.Messaging.Record.AppendToField< T > ( string  name,
ICollection< T >  values 
)

Appends one or more values to a repeating field.

This can only be used for a record that has metadata and for a Multiplicity.IsRepeating multiplicity field.

Adding the values must not cause the Multiplicity.Maximum number of values to be exceeded.

Template Parameters
T
Parameters
nameThe field name.
valuesThe value or values which are parsed according to the data type as specified in the metadata. If null or no values supplied then this call has no effect.
Returns
The number of values that the field has after the specified values have been added.
string PushTechnology.DiffusionCore.Messaging.Record.GetField ( string  name)

Gets a field value by name.

This can only be used for records with metadata and for a non-repeating field.

Parameters
nameThe field name.
Returns
The field value.
string PushTechnology.DiffusionCore.Messaging.Record.GetField ( int  index)

Returns a specific field value within the record.

Parameters
indexThe index of the field to return the value for, starting at 0.
Returns
The field at the specified index.
string PushTechnology.DiffusionCore.Messaging.Record.GetField ( string  name,
int  index 
)

Get the value of a specified occurrence of a repeating field.

This can only be used for a record that has metadata and for a field that is declared as repeating.

Parameters
nameThe name of the field.
indexThe index of the field value occurrence to return the value for.
Returns
The field occurrence value.
List<string> PushTechnology.DiffusionCore.Messaging.Record.GetFields ( )

Returns the values of all field occurrences within the record.

Returns
A list of the current field values within the record.
List<string> PushTechnology.DiffusionCore.Messaging.Record.GetFieldValues ( string  name)

Gets a list of field values.

This can only be used for records with metadata.

If the field is a repeating field then all of its current values will be returned (this could be empty for a final variable repeating field). If the field is non-repeating then a list containing the single value will be returned.

Parameters
name
Returns
List<object> PushTechnology.DiffusionCore.Messaging.Record.GetMappedFields ( )

This returns the fields of the record in a format mapped to the record metadata.

Each entry in the returned list represents a field entry in the metadata associated with the record.

Returns
string PushTechnology.DiffusionCore.Messaging.Record.RemoveField ( int  index)

Parameters
index
Returns
void PushTechnology.DiffusionCore.Messaging.Record.SetField ( int  index,
string  field 
)

Replaces a field at a specified index within the record.

This can only be used for free-format records (i.e. those without metadata).

Parameters
indexThe index of the field to replace.
fieldThe new field.
void PushTechnology.DiffusionCore.Messaging.Record.SetField ( string  name,
params object[]  values 
)

Set field value(s) by name.

This can only be used for a record that has metadata.

When used for a Multiplicity.IsSingle multiplicity field only a single value may be specified. If no value (or null) is specified then the field will set to the default value as indicated by the metadata.

When used for a Multiplicity.IsRepeating multiplicity field then multiple values may be specified. No more than the Multiplicity.Maximum number of values may be supplied.

Parameters
nameThe field name.
valuesThe value or values which are parsed according to the data type as specified in the metadata. Specifying no values will cause the field to be initialised to defaults (repeating fields will have the minimum number of occurrences set to default). A null value is also interpreted as default.
void PushTechnology.DiffusionCore.Messaging.Record.SetField ( string  name,
int  index,
object  value 
)

Sets a field value by name and index.

This can only be used for a record that has metadata and for a Multiplicity.IsRepeating multiplicity field.

Parameters
nameThe name of the field.
indexThe index of the field occurrence to set.
valueThe new field value which is parsed according to the data type indicated by the metadata. null is interpreted as the default value for the field as indicated by the metadata.
void PushTechnology.DiffusionCore.Messaging.Record.SetFieldValues< T > ( string  name,
ICollection< T >  values 
)

As SetField( string, params string [] object ), but allowing a collection of values to be supplied.

Template Parameters
T
Parameters
nameThe field name.
valuesThe value or values which are parsed according to the data type as specified in the metadata. Specifying no values will cause the field to be initialised to defaults (repeating fields will have the minimum number of occurrences set to default). A null value is also interpreted as default.
int PushTechnology.DiffusionCore.Messaging.Record.Size ( )

Returns the number of field values within the record.

Returns
The number of field values within the record.
int PushTechnology.DiffusionCore.Messaging.Record.SizeInBytes ( )

Returns the number of bytes that this record would occupy in a DataMessage that uses the default character set for byte encoding.

Returns
Total size (in bytes) that this record would use.
int PushTechnology.DiffusionCore.Messaging.Record.SizeInBytes ( System.Text.Encoding  encoding)

Returns the number of bytes that this record would occupy in a DataMessage that uses a specified character set for byte endoing.

Parameters
encodingThe encoding.
Returns
The total size (in bytes) that this record would use.
int PushTechnology.DiffusionCore.Messaging.Record.SizeInChars ( )

Returns the total number of characters within this record (including delimiters).

This can be used as a more efficient way of determining the size that the record would occupy within a DataMessage than using SizeInBytes() when it is known that the record only contains ASCII characters.

Returns
The sum of the string length of all fields within this record plus the total number of delimiters that would be used if the record was written to a message.
override string PushTechnology.DiffusionCore.Messaging.Record.ToString ( )

Returns the string representation of this object.

Returns

Property Documentation

MRecordImpl PushTechnology.DiffusionCore.Messaging.Record.MetaData
getset

Metadata to initialise and police the data - may be null for free for all processing.