SetGenericRecord Method
SetGenericRecord(string, IGenericRecord?)
Adds a IGenericRecord object field to the record.
Declaration
IGenericRecordBuilder SetGenericRecord(string fieldname, IGenericRecord? value)
Parameters
string | fieldname | The name of the field. |
IGenericRecord | value | The value of the field. |
Returns
IGenericRecordBuilder | This IGenericRecordBuilder. |
Remarks
It is only legal to set a generic record object produced by the same type of builder. For instance, a compact generic record can only accept a compact generic record. Trying to set a different kind of generic record results in a exception.
It is legal to set the field again only when the builder is created with NewBuilderWithClone(); it is otherwise illegal to set to the same field twice.
This method allows nested structures; subclasses should also be created as IGenericRecord of the same nature of the nesting one. I.e. compact records can only nest compact records.
Exceptions
SerializationException | The build has been initialized with a
schema, and |