Interface ISchemaBuilder
- Namespace
- PushTechnology.ClientInterface.Data.Record.Schema
- Assembly
- Diffusion.Client.dll
Builder to create an immutable ISchema.
public interface ISchemaBuilder
Remarks
A schema defines the records and fields that may occur in a RecordV2 topic value.
The schema must declare at least one record type and every record must have at least one field type declared.
Every record type and field type has a 'multiplicity' which defines the number of times that the record or field may occur within the data. Multiplicity is specified as a 'minimum' and 'maximum' number of occurrences or where the minimum and maximum are the same (fixed multiplicity) then the multiplicity may be specified as a single 'occurs' value. If the minimum and maximum are different, this is referred to a 'variable' multiplicity. Only the last record declared or the last field within a record may have variable multiplicity. The maximum value may be declared as -1 to indicate that the record or field can have an unlimited number of occurrences.
The builder is used to add a record definition followed by the fields within it. After all fields have been added to a record another may then be added, and so on, and then finally Build() is called to create an immutable schema object.
Every call returns the builder instance allowing calls to be chained. A builder is obtained using the CreateSchemaBuilder() method.
Implemented in Version 6.0.
Methods
Build()
Builds an immutable ISchema.
ISchema Build()
Returns
- ISchema
The new immutable schema object representing the current state of the builder.
Remarks
At least one record with at least one field must have been added to the builder.
Decimal(string, int)
Adds a single occurrence decimal field to the current record.
ISchemaBuilder Decimal(string name, int scale)
Parameters
namestringThe field name.
scaleintThe scale of the field (the number of decimal places). This must be a positive value.
Returns
- ISchemaBuilder
The current builder instance.
Remarks
This is the equivalent of calling Decimal(string, int, int) with the given scale and an occurs value of 1.
Decimal(string, int, int)
Adds a fixed multiplicity decimal field to the current record.
ISchemaBuilder Decimal(string name, int scale, int occurs)
Parameters
namestringThe field name.
scaleintThe scale of the field (the number of decimal places). This must be a positive value.
occursintThe fixed number of times the field should occur within the record. This must be positive.
Returns
- ISchemaBuilder
The current builder instance.
Remarks
This is the equivalent of calling Decimal(string, int, int, int) with the given scale and a min and max value equal to occurs.
Decimal(string, int, int, int)
Adds a decimal field to the current record.
ISchemaBuilder Decimal(string name, int scale, int min, int max)
Parameters
namestringThe field name. This must not be the same as any field already added to the builder.
scaleintThe scale of the field (the number of decimal places). This must be a positive value.
minintThe minimum number of times the field may occur within the record. This must not be negative.
maxintThe maximum number of times that the field may occur within the record. This must either be -1 (indicating no upper limit) or a positive value that is not less than min.
Returns
- ISchemaBuilder
The current builder instance.
Remarks
A field may not be added after a field that has variable multiplicity (min != max).
Integer(string)
Adds a single occurrence integer field to the current record.
ISchemaBuilder Integer(string name)
Parameters
namestringThe field name.
Returns
- ISchemaBuilder
The current builder instance.
Remarks
This is the equivalent of calling Integer(string, int) with an occurs value of 1.
Integer(string, int)
Adds a fixed multiplicity integer field to the current record.
ISchemaBuilder Integer(string name, int occurs)
Parameters
namestringThe field name.
occursintThe fixed number of times the field should occur within the record. This must be positive.
Returns
- ISchemaBuilder
The current builder instance.
Remarks
This is the equivalent of calling Integer(string, int, int) with a min and max value equal to occurs.
Integer(string, int, int)
Adds an integer field to the current record.
ISchemaBuilder Integer(string name, int min, int max)
Parameters
namestringThe field name. This must not be the same as any field already added to the record.
minintThe minimum number of times the field may occur within the record. This must not be negative.
maxintThe maximum number of times that the field may occur within the record. This must either be -1 (indicating no upper limit) or a positive value that is not less than min.
Returns
- ISchemaBuilder
The current builder instance.
Remarks
A field may not be added after a field that has variable multiplicity (min != max).
Record(string)
Adds a new single occurrence record to the schema.
ISchemaBuilder Record(string name)
Parameters
namestringThe record name.
Returns
- ISchemaBuilder
The current builder instance.
Remarks
This is the equivalent to calling Record(string, int) with an occurs value of 1.
Record(string, int)
Adds a new fixed multiplicity record to the schema.
ISchemaBuilder Record(string name, int occurs)
Parameters
namestringThe record name.
occursintThe number of times the record is to occur. This must be a positive value.
Returns
- ISchemaBuilder
The current builder instance.
Remarks
This is the equivalent to calling Record(string, int, int) with a min and max value equal to occurs.
Record(string, int, int)
Adds a new record to the schema.
ISchemaBuilder Record(string name, int min, int max)
Parameters
namestringThe record name.
minintThe minimum number of occurrences of the record. This must not be negative.
maxintThe maximum number of occurrences of the record. This must either be -1 to indicate an unlimited number or it must be a positive number greater than or equal to
min.
Returns
- ISchemaBuilder
The current builder instance.
Remarks
The record added must not have the same name as a previously added record.
A record may not be added after a record with variable multiplicity.
A record may not be added directly after another record which has had no fields added.
String(string)
Adds a single occurrence string field to the current record.
ISchemaBuilder String(string name)
Parameters
namestringThe field name.
Returns
- ISchemaBuilder
The current builder instance.
Remarks
This is the equivalent of calling String(string, int) with an occurs value of 1.
String(string, int)
Adds a fixed multiplicity string field to the current record.
ISchemaBuilder String(string name, int occurs)
Parameters
namestringThe field name.
occursintThe fixed number of times the field should occur within the record. This must be positive.
Returns
- ISchemaBuilder
The current builder instance.
Remarks
This is the equivalent of calling String(string, int, int) with a min and max value equal to occurs.
String(string, int, int)
Adds a string field to the current record.
ISchemaBuilder String(string name, int min, int max)
Parameters
namestringThe field name. This must not be the same as any field already added to the record.
minintThe minimum number of times the field may occur within the record. This must not be negative.
maxintThe maximum number of times that the field may occur within the record. This must either be -1 (indicating no upper limit) or a positive value that is not less than min.
Returns
- ISchemaBuilder
The current builder instance.
Remarks
A field may not be added after a field that has variable multiplicity (min != max).