Avro C#
 All Classes Namespaces Functions Variables Enumerations Properties
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Properties
Avro.Generic.PreresolvingDatumWriter< T > Class Template Reference

A general purpose writer of data from avro streams. This writer analyzes the writer schema when constructed so that writes can be more efficient. Once constructed, a writer can be reused or shared among threads to avoid incurring more resolution costs. More...

Inheritance diagram for Avro.Generic.PreresolvingDatumWriter< T >:
Avro.Generic.DatumWriter< T > Avro.Generic.GenericDatumWriter< T > Avro.Specific.SpecificDatumWriter< T >

List of all members.

Classes

interface  ArrayAccess
class  DictionaryMapAccess
interface  EnumAccess
interface  MapAccess
class  RecordFieldWriter

Public Member Functions

void Write (T datum, Encoder encoder)

Protected Member Functions

delegate void WriteItem (Object value, Encoder encoder)
 PreresolvingDatumWriter (Schema schema, ArrayAccess arrayAccess, MapAccess mapAccess)
void WriteNull (object value, Encoder encoder)
 Serializes a "null".
void Write< S > (object value, Schema.Type tag, Writer< S > writer)
 A generic method to serialize primitive Avro types.
abstract void WriteRecordFields (object record, RecordFieldWriter[] writers, Encoder encoder)
abstract void EnsureRecordObject (RecordSchema recordSchema, object value)
abstract void WriteField (object record, string fieldName, int fieldPos, WriteItem writer, Encoder encoder)
 Extracts the field value from the given object.
abstract WriteItem ResolveEnum (EnumSchema es)
 Serializes an enumeration.
WriteItem ResolveArray (ArraySchema schema)
 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.
void WriteMap (WriteItem itemWriter, object value, Encoder encoder)
 Serialized a map. The default implementation first ensure that the value is indeed a map and then uses GetMapSize() and GetMapElements() to access the contents of the map.
int ResolveUnion (UnionSchema us, Schema[] branchSchemas, 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.
abstract void WriteFixed (FixedSchema es, object value, Encoder encoder)
 Serialized a fixed object. The default implementation requires that the value is a GenericFixed object with an identical schema as es.
abstract bool UnionBranchMatches (Schema sc, object obj)

Static Protected Member Functions

static AvroException TypeMismatch (object obj, string schemaType, string type)

Properties

Schema Schema [get, set]

Detailed Description

template<T>
class Avro::Generic::PreresolvingDatumWriter< T >

A general purpose writer of data from avro streams. This writer analyzes the writer schema when constructed so that writes can be more efficient. Once constructed, a writer can be reused or shared among threads to avoid incurring more resolution costs.


Member Function Documentation

template<T >
WriteItem Avro.Generic.PreresolvingDatumWriter< T >.ResolveArray ( ArraySchema  schema) [inline, protected]

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:
schemaThe ArraySchema for serialization
valueThe value being serialized
encoderThe encoder for serialization
template<T >
abstract WriteItem Avro.Generic.PreresolvingDatumWriter< T >.ResolveEnum ( EnumSchema  es) [protected, pure virtual]

Serializes an enumeration.

Parameters:
esThe EnumSchema for serialization

Implemented in Avro.Generic.GenericDatumWriter< T >, and Avro.Specific.SpecificDatumWriter< T >.

template<T >
int Avro.Generic.PreresolvingDatumWriter< T >.ResolveUnion ( UnionSchema  us,
Schema[]  branchSchemas,
object  obj 
) [inline, protected]

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.

Parameters:
usThe UnionSchema to resolve against
objThe object that should be used in matching
Returns:
template<T >
void Avro.Generic.PreresolvingDatumWriter< T >.Write< S > ( object  value,
Schema.Type  tag,
Writer< S >  writer 
) [inline, protected]

A generic method to serialize primitive Avro types.

Template Parameters:
SType of the C# type to be serialized
Parameters:
valueThe value to be serialized
tagThe schema type tag
writerThe writer which should be used to write the given type.
template<T >
abstract void Avro.Generic.PreresolvingDatumWriter< T >.WriteField ( object  record,
string  fieldName,
int  fieldPos,
WriteItem  writer,
Encoder  encoder 
) [protected, pure virtual]

Extracts the field value from the given object.

Parameters:
valueThe record value from which the field needs to be extracted
fieldNameThe name of the field in the record
fieldPosThe position of field in the record
Returns:

Implemented in Avro.Generic.GenericDatumWriter< T >, and Avro.Specific.SpecificDatumWriter< T >.

template<T >
abstract void Avro.Generic.PreresolvingDatumWriter< T >.WriteFixed ( FixedSchema  es,
object  value,
Encoder  encoder 
) [protected, pure virtual]

Serialized a fixed object. The default implementation requires that the value is a GenericFixed object with an identical schema as es.

Parameters:
esThe schema for serialization
valueThe value to be serialized
encoderThe encoder for serialization

Implemented in Avro.Specific.SpecificDatumWriter< T >, and Avro.Generic.GenericDatumWriter< T >.

template<T >
void Avro.Generic.PreresolvingDatumWriter< T >.WriteMap ( WriteItem  itemWriter,
object  value,
Encoder  encoder 
) [inline, protected]

Serialized a map. The default implementation first ensure that the value is indeed a map and then uses GetMapSize() and GetMapElements() to access the contents of the map.

Parameters:
schemaThe MapSchema for serialization
valueThe value to be serialized
encoderThe encoder for serialization
template<T >
void Avro.Generic.PreresolvingDatumWriter< T >.WriteNull ( object  value,
Encoder  encoder 
) [inline, protected]

Serializes a "null".

Parameters:
valueThe object to be serialized using null schema
encoderThe encoder to use while serialization

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Enumerations Properties