Avro C#

Public Member Functions | Protected Member Functions | Properties | List of all members
Avro.Reflect.ReflectDefaultWriter Class Reference

Class for writing data from any specific objects More...

Inheritance diagram for Avro.Reflect.ReflectDefaultWriter:

## Public Member Functions
| ReflectDefaultWriter (Type objType, Schema schema, ClassCache cache)
| Constructor More...
| ReflectDefaultWriter (Schema schema)
| Constructor More...
Public Member Functions inherited from Avro.Specific.SpecificDefaultWriter
| SpecificDefaultWriter (Schema schema)
| Constructor More...
Public Member Functions inherited from Avro.Generic.DefaultWriter
| DefaultWriter (Schema schema)
| Constructs a generic writer for the given schema. More...
void | Write< T > (T value, Encoder encoder)
| Examines the Schema and dispatches the actual work to one of the other methods of this class. This allows the derived classes to override specific methods and get custom results. More...
virtual void | Write (Schema schema, object value, Encoder encoder)
| Examines the schema and dispatches the actual work to one of the other methods of this class. This allows the derived classes to override specific methods and get custom results. More...

## Protected Member Functions
override void | WriteRecord (RecordSchema schema, object value, Encoder encoder)
| Serialized a record using the given RecordSchema. It uses GetField method to extract the field value from the given object. More...
override void | WriteFixed (FixedSchema schema, object value, Encoder encoder)
| Validates that the record is a fixed record object and that the schema in the object is the same as the given writer schema. Writes the given fixed record into the given encoder More...
override void | WriteArray (ArraySchema schema, object value, Encoder encoder)
| Serialized an array. The default implementation calls EnsureArrayObject() to ascertain that the given value is an array. It then calls GetArrayLength() and GetArrayElement() to access the members of the array and then serialize them. More...
override void | WriteMap (MapSchema schema, object value, Encoder encoder)
| Writes the given map into the given encoder. More...
override bool | Matches (Schema sc, object obj)
| Determines whether an object matches a schema. In the case of enums and records the code looks up the Enum and class caches respectively. Used when writing unions. More...
Protected Member Functions inherited from Avro.Specific.SpecificDefaultWriter
override void | WriteRecord (RecordSchema schema, object value, Encoder encoder)
| Serialized a record using the given RecordSchema. It uses GetField method to extract the field value from the given object. More...
override void | WriteFixed (FixedSchema schema, object value, Encoder encoder)
| Validates that the record is a fixed record object and that the schema in the object is the same as the given writer schema. Writes the given fixed record into the given encoder More...
override void | WriteEnum (EnumSchema schema, object value, Encoder encoder)
| Writes the given enum value into the given encoder. More...
override void | WriteArray (ArraySchema schema, object value, Encoder encoder)
| Serialized an array. The default implementation calls EnsureArrayObject() to ascertain that the given value is an array. It then calls GetArrayLength() and GetArrayElement() to access the members of the array and then serialize them. More...
override void | WriteMap (MapSchema schema, object value, Encoder encoder)
| Writes the given map into the given encoder. More...
override void | WriteUnion (UnionSchema us, object value, Encoder encoder)
| Resolves the given value against the given UnionSchema and serializes the object against the resolved schema member. The default implementation of this method uses ResolveUnion to find the member schema within the UnionSchema. More...
override bool | Matches (Schema sc, object obj)
| Tests whether the given schema an object are compatible.
Protected Member Functions inherited from Avro.Generic.DefaultWriter
virtual void | WriteNull (object value, Encoder encoder)
| Serializes a "null" More...
virtual void | Write< T > (object value, Schema.Type tag, Writer< T > writer)
| A generic method to serialize primitive Avro types. More...
virtual void | EnsureRecordObject (RecordSchema s, object value)
| Ensures that the given value is a record and that it corresponds to the given schema. Throws an exception if either of those assertions are false. More...
virtual object | GetField (object value, string fieldName, int fieldPos)
| Extracts the field value from the given object. In this default implementation, value should be of type GenericRecord. More...
virtual void | EnsureArrayObject (object value)
| Checks if the given object is an array. If it is a valid array, this function returns normally. Otherwise, it throws an exception. The default implementation checks if the value is an array. More...
virtual long | GetArrayLength (object value)
| Returns the length of an array. The default implementation requires the object to be an array of objects and returns its length. The default implementation guarantees that EnsureArrayObject() has been called on the value before this function is called. More...
virtual object | GetArrayElement (object value, long index)
| Returns the element at the given index from the given array object. The default implementation requires that the value is an object array and returns the element in that array. The default implementation guarantees that EnsureArrayObject() has been called on the value before this function is called. More...
virtual void | EnsureMapObject (object value)
| Checks if the given object is a map. If it is a valid map, this function returns normally. Otherwise, it throws an exception. The default implementation checks if the value is an IDictionary<string, object>. More...
virtual long | GetMapSize (object value)
| Returns the size of the map object. The default implementation guarantees that EnsureMapObject has been successfully called with the given value. The default implementation requires the value to be an IDictionary<string, object> and returns the number of elements in it. More...
virtual IEnumerable< KeyValuePair< string, object > > | GetMapValues (object value)
| Returns the contents of the given map object. The default implementation guarantees that EnsureMapObject has been called with the given value. The default implementation of this method requires that the value is an IDictionary<string, object> and returns its contents. More...
virtual int | ResolveUnion (UnionSchema us, object obj)
| Finds the branch within the given UnionSchema that matches the given object. The default implementation calls Matches() method in the order of branches within the UnionSchema. If nothing matches, throws an exception. More...
virtual void | WriteLogical (LogicalSchema ls, object value, Encoder encoder)
| Serializes a logical value object by using the underlying logical type to convert the value to its base value. More...
AvroException | TypeMismatch (object obj, string schemaType, string type)
| Creates a new AvroException and uses the provided parameters to build an exception message indicating there was a type mismatch. More...

## Properties
ClassCache | ClassCache`[get]`
| Class cache More...
Properties inherited from Avro.Generic.DefaultWriter
Schema | Schema`[get]`
| Schema that this object uses to write datum. More...

## Detailed Description

Class for writing data from any specific objects

## Constructor & Destructor Documentation

## ◆ ReflectDefaultWriter() [1/2]

Avro.Reflect.ReflectDefaultWriter.ReflectDefaultWriter | ( | Type | objType,
|  | Schema | schema,
|  | ClassCache | cache
| ) |  |
| inline

Constructor

Parameters

  objType |
  schema |
  cache |

## ◆ ReflectDefaultWriter() [2/2]

Avro.Reflect.ReflectDefaultWriter.ReflectDefaultWriter | ( | Schema | schema | ) |
| inline

Constructor

Parameters

  schema |

## Member Function Documentation

## ◆ Matches()

override bool Avro.Reflect.ReflectDefaultWriter.Matches | ( | Schema | sc,
|  | object | obj
| ) |  |
| inline protected virtual

Determines whether an object matches a schema. In the case of enums and records the code looks up the Enum and class caches respectively. Used when writing unions.

Parameters

  sc |
  obj |

Returns

Reimplemented from Avro.Generic.DefaultWriter.

## ◆ WriteArray()

override void Avro.Reflect.ReflectDefaultWriter.WriteArray | ( | ArraySchema | schema,
|  | object | value,
|  | Encoder | encoder
| ) |  |
| inline protected virtual

Serialized an array. The default implementation calls EnsureArrayObject() to ascertain that the given value is an array. It then calls GetArrayLength() and GetArrayElement() to access the members of the array and then serialize them.

Parameters

  schema | The ArraySchema for serialization
  value | The value being serialized
  encoder | The encoder for serialization

Reimplemented from Avro.Generic.DefaultWriter.

## ◆ WriteFixed()

override void Avro.Reflect.ReflectDefaultWriter.WriteFixed | ( | FixedSchema | schema,
|  | object | value,
|  | Encoder | encoder
| ) |  |
| inline protected virtual

Validates that the record is a fixed record object and that the schema in the object is the same as the given writer schema. Writes the given fixed record into the given encoder

Parameters

  schema | writer schema
  value | fixed object to write
  encoder | encoder to write to

Reimplemented from Avro.Generic.DefaultWriter.

## ◆ WriteMap()

override void Avro.Reflect.ReflectDefaultWriter.WriteMap | ( | MapSchema | schema,
|  | object | value,
|  | Encoder | encoder
| ) |  |
| inline protected virtual

Writes the given map into the given encoder.

Parameters

  schema | writer schema
  value | map to write
  encoder | encoder to write to

Reimplemented from Avro.Generic.DefaultWriter.

## ◆ WriteRecord()

override void Avro.Reflect.ReflectDefaultWriter.WriteRecord | ( | RecordSchema | schema,
|  | object | value,
|  | Encoder | encoder
| ) |  |
| inline protected virtual

Serialized a record using the given RecordSchema. It uses GetField method to extract the field value from the given object.

Parameters

  schema | The RecordSchema to use for serialization
  value | The value to be serialized
  encoder | The Encoder for serialization

Reimplemented from Avro.Generic.DefaultWriter.

## Property Documentation

## ◆ ClassCache

ClassCache Avro.Reflect.ReflectDefaultWriter.ClassCache
| get

Class cache

The documentation for this class was generated from the following file:

- src/apache/main/Reflect/ReflectDefaultWriter.cs