Interface ISchemaBuilder
Builder to create an immutable ISchema.
Namespace: PushTechnology.ClientInterface.Data.Record.Schema
Assembly: Diffusion.Client.dll
Syntax
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.
Declaration
ISchema Build()
Returns
Type | Description |
---|---|
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, Int32)
Adds a single occurrence decimal field to the current record.
Declaration
ISchemaBuilder Decimal(string name, int scale)
Parameters
Type | Name | Description |
---|---|---|
String | name | The field name. |
Int32 | scale | The scale of the field (the number of decimal places). This must be a positive value. |
Returns
Type | Description |
---|---|
ISchemaBuilder | The current builder instance. |
Remarks
This is the equivalent of calling Decimal(String, Int32, Int32) with the given scale and an occurs value of 1.
Decimal(String, Int32, Int32)
Adds a fixed multiplicity decimal field to the current record.
Declaration
ISchemaBuilder Decimal(string name, int scale, int occurs)
Parameters
Type | Name | Description |
---|---|---|
String | name | The field name. |
Int32 | scale | The scale of the field (the number of decimal places). This must be a positive value. |
Int32 | occurs | The fixed number of times the field should occur within the record. This must be positive. |
Returns
Type | Description |
---|---|
ISchemaBuilder | The current builder instance. |
Remarks
This is the equivalent of calling Decimal(String, Int32, Int32, Int32) with the given scale and a min and max value equal to occurs.
Decimal(String, Int32, Int32, Int32)
Adds a decimal field to the current record.
Declaration
ISchemaBuilder Decimal(string name, int scale, int min, int max)
Parameters
Type | Name | Description |
---|---|---|
String | name | The field name. This must not be the same as any field already added to the builder. |
Int32 | scale | The scale of the field (the number of decimal places). This must be a positive value. |
Int32 | min | The minimum number of times the field may occur within the record. This must not be negative. |
Int32 | max | The 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
Type | Description |
---|---|
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.
Declaration
ISchemaBuilder Integer(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The field name. |
Returns
Type | Description |
---|---|
ISchemaBuilder | The current builder instance. |
Remarks
This is the equivalent of calling Integer(String, Int32) with an occurs value of 1.
Integer(String, Int32)
Adds a fixed multiplicity integer field to the current record.
Declaration
ISchemaBuilder Integer(string name, int occurs)
Parameters
Type | Name | Description |
---|---|---|
String | name | The field name. |
Int32 | occurs | The fixed number of times the field should occur within the record. This must be positive. |
Returns
Type | Description |
---|---|
ISchemaBuilder | The current builder instance. |
Remarks
This is the equivalent of calling Integer(String, Int32, Int32) with a min and max value equal to occurs.
Integer(String, Int32, Int32)
Adds an integer field to the current record.
Declaration
ISchemaBuilder Integer(string name, int min, int max)
Parameters
Type | Name | Description |
---|---|---|
String | name | The field name. This must not be the same as any field already added to the record. |
Int32 | min | The minimum number of times the field may occur within the record. This must not be negative. |
Int32 | max | The 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
Type | Description |
---|---|
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.
Declaration
ISchemaBuilder Record(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The record name. |
Returns
Type | Description |
---|---|
ISchemaBuilder | The current builder instance. |
Remarks
This is the equivalent to calling Record(String, Int32) with an occurs value of 1.
Record(String, Int32)
Adds a new fixed multiplicity record to the schema.
Declaration
ISchemaBuilder Record(string name, int occurs)
Parameters
Type | Name | Description |
---|---|---|
String | name | The record name. |
Int32 | occurs | The number of times the record is to occur. This must be a positive value. |
Returns
Type | Description |
---|---|
ISchemaBuilder | The current builder instance. |
Remarks
This is the equivalent to calling Record(String, Int32, Int32) with a min and max value equal to occurs.
Record(String, Int32, Int32)
Adds a new record to the schema.
Declaration
ISchemaBuilder Record(string name, int min, int max)
Parameters
Type | Name | Description |
---|---|---|
String | name | The record name. |
Int32 | min | The minimum number of occurrences of the record. This must not be negative. |
Int32 | max | The 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 |
Returns
Type | Description |
---|---|
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.
Declaration
ISchemaBuilder String(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The field name. |
Returns
Type | Description |
---|---|
ISchemaBuilder | The current builder instance. |
Remarks
This is the equivalent of calling String(String, Int32) with an occurs value of 1.
String(String, Int32)
Adds a fixed multiplicity string field to the current record.
Declaration
ISchemaBuilder String(string name, int occurs)
Parameters
Type | Name | Description |
---|---|---|
String | name | The field name. |
Int32 | occurs | The fixed number of times the field should occur within the record. This must be positive. |
Returns
Type | Description |
---|---|
ISchemaBuilder | The current builder instance. |
Remarks
This is the equivalent of calling String(String, Int32, Int32) with a min and max value equal to occurs.
String(String, Int32, Int32)
Adds a string field to the current record.
Declaration
ISchemaBuilder String(string name, int min, int max)
Parameters
Type | Name | Description |
---|---|---|
String | name | The field name. This must not be the same as any field already added to the record. |
Int32 | min | The minimum number of times the field may occur within the record. This must not be negative. |
Int32 | max | The 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
Type | Description |
---|---|
ISchemaBuilder | The current builder instance. |
Remarks
A field may not be added after a field that has variable multiplicity (min != max).