new Record()
Deprecated
As of 6.0, RecordContent is deprecated. Instead, use the RecordV2 Data Type for record-based values.Defines a named record. A record may contain Fields which specify value types.
- Deprecated:
-
- Yes
Properties:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
name |
String | The name of the record used for adding records via RecordContent.Builder#add. | ||
occurs |
diffusion.metadata.RecordContent.Occurs |
<optional> |
1 | The number of times this record can occur. |
Methods
-
addField(name, type, occurs) → {diffusion.metadata.RecordContent.Field}
-
Add a named field to this Record with a specified type.
The type may be one of:
Alternatively, you may provide a default value instead of the type; the appropriate metadata will be created automatically with the supplied value used as the default.If no type is provided, Metadata.String will be used.
An optional occurs may be provided to specify the amount of times this field may occur.
Parameters:
Name Type Argument Default Description name
String The field name type
diffusion.metadata | Object <optional>
diffusion.metadata.String The field type or default value occurs
diffusion.metadata.RecordContent.Occurs | Number <optional>
1 Number of times this field may occur Returns:
The fieldExamples
// Add a field with a default value var fieldMeta = recordMeta.addField('field', 123);
// Add a field with specified type that repeats three times var fieldMeta = recordMeta.addField('field', new diffusion.metadata.Integer(0), 3);
-
getField(key) → {diffusion.metadata.RecordContent.Field}
-
Get a field that is attached to this record by name or index.
If a string is provided, this will lookup the field that was added with that same name. If a number is given, this will be treated as the zero-indexed number of the field to return.
Parameters:
Name Type Description key
Number | String The key to lookup the field with Returns:
The field, ornull
Examples
// Get the field named 'foo' var fieldMeta = recordMeta.getField('foo');
// Get the first field that was added var fieldMeta = recordMeta.getField(0);
-
getFields() → {Array.<diffusion.metadata.RecordContent.Field>}
-
Get all fields in order, as an array.
Returns:
The fields- Type
- Array.<diffusion.metadata.RecordContent.Field>