Table of Contents

Class GenericRecordBuilder

Namespace
AvroSharp.Generic
Assembly
AvroSharp.dll

Builds a GenericRecord field by field, as Apache Avro Java's GenericRecordBuilder does: a field left unset takes its schema default, and a field with neither a value nor a default is an error.

public sealed class GenericRecordBuilder
Inheritance
GenericRecordBuilder
Inherited Members

Examples

var user = new GenericRecordBuilder(schema).Set("id", 1).Set("name", "Ada").Build();

Constructors

GenericRecordBuilder(RecordSchema)

Initializes a builder with no field set.

Properties

Schema

Gets the record schema.

Methods

Build()

Creates a record from the fields set so far, and the defaults of the others. Each call creates a new record with its own copy of each default; the values set are shared, not copied.

IsSet(string)

Gets whether a field has been set.

Set(int, AvroValue)

Sets a field by position. The value is not copied or checked against the field's schema.

Set(string, AvroValue)

Sets a field by name. The value is not copied or checked against the field's schema.

See Also