Class: Record

RecordContent.Builder. Record

new Record()

A builder for a specific RecordContent.Record, created by a RecordContent.Builder instance.


Allows the setting of field values based on name and index.

Methods

add(name, value)

Add a field value for a given name. If the associated metadata allows multiple fields, this will append the new field value up until the maximum limit.

If the name or value do not conform to the associated metadata, this will throw an error.

Parameters:
Name Type Description
name String The field name
value Object The field value
Throws:
Error if the name or value are not allowed by the metadata
Example
// Add two separate field values with different names
rbuilder.add('foo', 'bar');
rbuilder.add('bing', 123);

set(name, value, index) → {RecordContent.Builder.Record}

Set a field value with a given name and index. If the field does not exist, it will be created.


An error will be thrown if the value or index are not supported by the associated metadata.

Parameters:
Name Type Argument Default Description
name String The field name
value Object The field value
index Number <optional>
0 The field index
Throws:
Error if the supplied arguments are unsupported by the associated metadata
Returns:
This builder
Type
RecordContent.Builder.Record
Example
// Set the second value
rbuilder.set('foo', 'baz', 1);