Diffusion Apple API  6.9.0
Unified Client Library for iOS, tvOS and OS X / macOS
 All Classes Files Functions Variables Enumerations Enumerator Properties Pages
Instance Methods | List of all members
PTDiffusionRecordV2SchemaBuilder Class Reference

Introduction

Used to build an immutable PTDiffusionRecordV2Schema.

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 (PTDiffusionRecordV2SchemaBuilder) is queried to return an immutable schema object.

Every mutating method returns the builder instance allowing calls to be chained.

Since
6.0
Inheritance diagram for PTDiffusionRecordV2SchemaBuilder:

Instance Methods

(PTDiffusionRecordV2Schema *) - build
 
(instancetype) - addRecordWithName:
 
(instancetype) - addRecordWithName:occurs:
 
(instancetype) - addRecordWithName:min:max:
 
(instancetype) - addStringWithName:
 
(instancetype) - addStringWithName:occurs:
 
(instancetype) - addStringWithName:min:max:
 
(instancetype) - addIntegerWithName:
 
(instancetype) - addIntegerWithName:occurs:
 
(instancetype) - addIntegerWithName:min:max:
 
(instancetype) - addDecimalWithName:scale:
 
(instancetype) - addDecimalWithName:scale:occurs:
 
(instancetype) - addDecimalWithName:scale:min:max:
 

Method Documentation

- (instancetype) addDecimalWithName: (NSString *)  name
scale: (SInt32)  scale 

Add a new single occurrence decimal field to the current record.

This is the equivalent to calling addDecimalWithName:scale:occurs: with a value of 1 for occurs.

Parameters
nameThe field name. This must not be the same as any field already added to the record.
scaleThe scale of the field (the number of decimal places). This must must be a positive value.
Returns
This builder.
Exceptions
NSInvalidArgumentExceptionIf name is nil or scale is less than one.
NSInternalInconsistencyExceptionIf schema rules are violated.
Since
6.0
- (instancetype) addDecimalWithName: (NSString *)  name
scale: (SInt32)  scale
min: (SInt32)  min
max: (SInt32)  max 

Add a new decimal field to the current record.

Parameters
nameThe field name. This must not be the same as any field already added to the record.
scaleThe scale of the field (the number of decimal places). This must must be a positive value.
minThe minimum number of occurrences of the field within the record.
maxThe maximum number of occurrences of the field within 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
This builder.
Exceptions
NSInvalidArgumentExceptionIf name is nil or max is invalid.
NSInternalInconsistencyExceptionIf schema rules are violated.
Since
6.0
- (instancetype) addDecimalWithName: (NSString *)  name
scale: (SInt32)  scale
occurs: (SInt32)  occurs 

Add a new fixed multiplicity decimal field to the current record.

This is the equivalent to calling addDecimalWithName:scale:min:max: with the value of occurs for both min and max.

Parameters
nameThe field name. This must not be the same as any field already added to the record.
scaleThe scale of the field (the number of decimal places). This must must be a positive value.
occursThe number of times the field is to occur within the record. This must be a positive value.
Returns
This builder.
Exceptions
NSInvalidArgumentExceptionIf name is nil, scale is less than one or occurs is less than one.
NSInternalInconsistencyExceptionIf schema rules are violated.
Since
6.0
- (instancetype) addIntegerWithName: (NSString *)  name

Add a new single occurrence integer field to the current record.

This is the equivalent to calling addIntegerWithName:occurs: with a value of 1 for occurs.

Parameters
nameThe field name. This must not be the same as any field already added to the record.
Returns
This builder.
Exceptions
NSInvalidArgumentExceptionIf name is nil.
NSInternalInconsistencyExceptionIf schema rules are violated.
Since
6.0
- (instancetype) addIntegerWithName: (NSString *)  name
min: (SInt32)  min
max: (SInt32)  max 

Add a new integer field to the current record.

Parameters
nameThe field name. This must not be the same as any field already added to the record.
minThe minimum number of occurrences of the field within the record.
maxThe maximum number of occurrences of the field within 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
This builder.
Exceptions
NSInvalidArgumentExceptionIf name is nil or max is invalid.
NSInternalInconsistencyExceptionIf schema rules are violated.
Since
6.0
- (instancetype) addIntegerWithName: (NSString *)  name
occurs: (SInt32)  occurs 

Add a new fixed multiplicity integer field to the current record.

This is the equivalent to calling addIntegerWithName:min:max: with the value of occurs for both min and max.

Parameters
nameThe field name. This must not be the same as any field already added to the record.
occursThe number of times the field is to occur within the record. This must be a positive value.
Returns
This builder.
Exceptions
NSInvalidArgumentExceptionIf name is nil or occurs is less than one.
NSInternalInconsistencyExceptionIf schema rules are violated.
Since
6.0
- (instancetype) addRecordWithName: (NSString *)  name

Add a new single occurrence record to the schema.

This is the equivalent to calling addRecordWithName:occurs: with a value of 1 for occurs.

Parameters
nameThe record name.
Returns
This builder.
Exceptions
NSInvalidArgumentExceptionIf name is nil.
NSInternalInconsistencyExceptionIf schema rules are violated.
Since
6.0
- (instancetype) addRecordWithName: (NSString *)  name
min: (SInt32)  min
max: (SInt32)  max 

Add a new record to the schema.

Parameters
nameThe record name.
minThe minimum number of occurrences of the record.
maxThe 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
This builder.
Exceptions
NSInvalidArgumentExceptionIf name is nil or max is invalid.
NSInternalInconsistencyExceptionIf schema rules are violated.
Since
6.0
- (instancetype) addRecordWithName: (NSString *)  name
occurs: (SInt32)  occurs 

Add a new fixed multiplicity record to the schema.

This is the equivalent to calling addRecordWithName:min:max: with the value of occurs for both min and max.

Parameters
nameThe record name.
occursThe number of times the record is to occur. This must be a positive value.
Returns
This builder.
Exceptions
NSInvalidArgumentExceptionIf name is nil or occurs is less than one.
NSInternalInconsistencyExceptionIf schema rules are violated.
Since
6.0
- (instancetype) addStringWithName: (NSString *)  name

Add a new single occurrence string field to the current record.

This is the equivalent to calling addStringWithName:occurs: with a value of 1 for occurs.

Parameters
nameThe field name. This must not be the same as any field already added to the record.
Returns
This builder.
Exceptions
NSInvalidArgumentExceptionIf name is nil.
NSInternalInconsistencyExceptionIf schema rules are violated.
Since
6.0
- (instancetype) addStringWithName: (NSString *)  name
min: (SInt32)  min
max: (SInt32)  max 

Add a new string field to the current record.

Parameters
nameThe field name. This must not be the same as any field already added to the record.
minThe minimum number of occurrences of the field within the record.
maxThe maximum number of occurrences of the field within 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
This builder.
Exceptions
NSInvalidArgumentExceptionIf name is nil or max is invalid.
NSInternalInconsistencyExceptionIf schema rules are violated.
Since
6.0
- (instancetype) addStringWithName: (NSString *)  name
occurs: (SInt32)  occurs 

Add a new fixed multiplicity string field to the current record.

This is the equivalent to calling addStringWithName:min:max: with the value of occurs for both min and max.

Parameters
nameThe field name. This must not be the same as any field already added to the record.
occursThe number of times the field is to occur within the record. This must be a positive value.
Returns
This builder.
Exceptions
NSInvalidArgumentExceptionIf name is nil or occurs is less than one.
NSInternalInconsistencyExceptionIf schema rules are violated.
Since
6.0

Returns an immutable schema from the current state of this builder.

Returns
Immutable schema from the current state of this builder.
Exceptions
NSInternalInconsistencyExceptionNo records have been specified yet for this builder instance.
Since
6.0