Avro C#
Public Member Functions | Protected Member Functions | Properties | List of all members
Avro.Reflect.ReflectDefaultReader Class Reference

Reader class for reading data and storing into specific classes More...

Inheritance diagram for Avro.Reflect.ReflectDefaultReader:
Avro.Specific.SpecificDefaultReader Avro.Generic.DefaultReader

Public Member Functions

 ReflectDefaultReader (Type objType, Schema writerSchema, Schema readerSchema, ClassCache cache)
 Constructor More...
 
object GetDefaultValue (Schema s, JToken defaultValue)
 Gets the default value for a schema object More...
 
- Public Member Functions inherited from Avro.Specific.SpecificDefaultReader
 SpecificDefaultReader (Schema writerSchema, Schema readerSchema)
 Constructor More...
 
- Public Member Functions inherited from Avro.Generic.DefaultReader
 DefaultReader (Schema writerSchema, Schema readerSchema)
 Constructs the default reader for the given schemas using the DefaultReader. If the reader's and writer's schemas are different this class performs the resolution. This default implementation maps Avro types to .NET types as follows: More...
 
Read< T > (T reuse, Decoder decoder)
 Reads an object off the stream. More...
 
object Read (object reuse, Schema writerSchema, Schema readerSchema, Decoder d)
 Reads an object off the stream. More...
 

Protected Member Functions

override object ReadEnum (object reuse, EnumSchema writerSchema, Schema readerSchema, Decoder d)
 Deserializes a enum. Uses CreateEnum to construct the new enum object. More...
 
override object ReadRecord (object reuse, RecordSchema writerSchema, Schema readerSchema, Decoder dec)
 Deserializes a record from the stream. More...
 
override object ReadFixed (object reuse, FixedSchema writerSchema, Schema readerSchema, Decoder d)
 Deserializes a fixed object and returns the object. The default implementation uses CreateFixed() and GetFixedBuffer() and returns what CreateFixed() returned. More...
 
override object ReadArray (object reuse, ArraySchema writerSchema, Schema readerSchema, Decoder dec)
 Reads an array from the given decoder More...
 
override object ReadMap (object reuse, MapSchema writerSchema, Schema readerSchema, Decoder d)
 Deserialized an avro map. More...
 
- Protected Member Functions inherited from Avro.Specific.SpecificDefaultReader
override object ReadRecord (object reuse, RecordSchema writerSchema, Schema readerSchema, Decoder dec)
 Deserializes a record from the stream. More...
 
override object ReadFixed (object reuse, FixedSchema writerSchema, Schema readerSchema, Decoder d)
 Deserializes a fixed object and returns the object. The default implementation uses CreateFixed() and GetFixedBuffer() and returns what CreateFixed() returned. More...
 
override object ReadEnum (object reuse, EnumSchema writerSchema, Schema readerSchema, Decoder dec)
 Reads an enum from the given decoder More...
 
override object ReadArray (object reuse, ArraySchema writerSchema, Schema readerSchema, Decoder dec)
 Reads an array from the given decoder More...
 
override object ReadMap (object reuse, MapSchema writerSchema, Schema readerSchema, Decoder d)
 Deserialized an avro map. The default implementation creates a new map using CreateMap() and then adds elements to the map using AddMapEntry(). More...
 
virtual string getTargetType (Schema schema)
 Gets the target type name in the given schema More...
 
- Protected Member Functions inherited from Avro.Generic.DefaultReader
virtual object ReadNull (Schema readerSchema, Decoder d)
 Deserializes a null from the stream. More...
 
Read< T > (Schema.Type tag, Schema readerSchema, Reader< T > reader)
 A generic function to read primitive types More...
 
virtual object CreateRecord (object reuse, RecordSchema readerSchema)
 Creates a new record object. Derived classes can override this to return an object of their choice. More...
 
virtual bool TryGetField (object record, string fieldName, int fieldPos, out object value)
 Used by the default implementation of ReadRecord() to get the existing field of a record object. The derived classes can override this to make their own interpretation of the record object. More...
 
virtual void AddField (object record, string fieldName, int fieldPos, object fieldValue)
 Used by the default implementation of ReadRecord() to add a field to a record object. The derived classes can override this to suit their own implementation of the record object. More...
 
virtual object CreateEnum (object reuse, EnumSchema es, string symbol)
 Used by the default implementation of ReadEnum to construct a new enum object. More...
 
virtual object CreateArray (object reuse, ArraySchema rs)
 Creates a new array object. The initial size of the object could be anything. The users should use GetArraySize() to determine the size. The default implementation creates an object[]. More...
 
virtual int GetArraySize (object array)
 Returns the size of the given array object. More...
 
virtual void ResizeArray (ref object array, int n)
 Resizes the array to the new value. More...
 
virtual void SetArrayElement (object array, int index, object value)
 Assigns a new value to the object at the given index More...
 
virtual object GetArrayElement (object array, int index)
 Returns the element at the given index. More...
 
virtual object CreateMap (object reuse, MapSchema ms)
 Used by the default implementation of ReadMap() to create a fresh map object. The default implementation of this method returns a IDictionary<string, map>. More...
 
virtual void AddMapEntry (object map, string key, object value)
 Adds an entry to the map. More...
 
virtual object ReadUnion (object reuse, UnionSchema writerSchema, Schema readerSchema, Decoder d)
 Deserialized an object based on the writer's union schema. More...
 
virtual object ReadLogical (object reuse, LogicalSchema writerSchema, Schema readerSchema, Decoder d)
 Deserializes an object based on the writer's logical schema. Uses the underlying logical type to convert the value to the logical type. More...
 
virtual object CreateFixed (object reuse, FixedSchema rs)
 Returns a fixed object. More...
 
virtual byte[] GetFixedBuffer (object f)
 Returns a buffer of appropriate size to read data into. More...
 
virtual void Skip (Schema writerSchema, Decoder d)
 Skip an instance of a schema. More...
 

Properties

Type MapType [get, set]
 C# type to create when deserializing a map. Must implement IDictionary<,> and the first type parameter must be a string. Default is System.Collections.Generic.Dictionary More...
 
ClassCache ClassCache [get]
 Class cache More...
 
Func< Type, object > RecordFactory [get, set]
 Delegate to a factory method to create objects of type x. If you are deserializing to interfaces you could use an IoC container factory instead of the default. Default is Activator.CreateInstance() More...
 
- Properties inherited from Avro.Generic.DefaultReader
Schema ReaderSchema [get]
 Schema to use when reading data with this reader. More...
 
Schema WriterSchema [get]
 Schema used to write data that we are reading with this reader. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from Avro.Generic.DefaultReader
static Schema findBranch (UnionSchema us, Schema s)
 Finds the branch of the union schema associated with the given schema. More...
 

Detailed Description

Reader class for reading data and storing into specific classes

Constructor & Destructor Documentation

◆ ReflectDefaultReader()

Avro.Reflect.ReflectDefaultReader.ReflectDefaultReader ( Type  objType,
Schema  writerSchema,
Schema  readerSchema,
ClassCache  cache 
)
inline

Constructor

Parameters
objType
writerSchema
readerSchema
cache

Member Function Documentation

◆ GetDefaultValue()

object Avro.Reflect.ReflectDefaultReader.GetDefaultValue ( Schema  s,
JToken  defaultValue 
)
inline

Gets the default value for a schema object

Parameters
s
defaultValue
Returns

◆ ReadArray()

override object Avro.Reflect.ReflectDefaultReader.ReadArray ( object  reuse,
ArraySchema  writerSchema,
Schema  readerSchema,
Decoder  dec 
)
inlineprotectedvirtual

Reads an array from the given decoder

Parameters
reuseobject to store data read
writerSchemaschema of the object that wrote the data
readerSchemaschema of the object that will store the data
decdecoder object that contains the data to be read
Returns
array

Reimplemented from Avro.Generic.DefaultReader.

◆ ReadEnum()

override object Avro.Reflect.ReflectDefaultReader.ReadEnum ( object  reuse,
EnumSchema  writerSchema,
Schema  readerSchema,
Decoder  d 
)
inlineprotectedvirtual

Deserializes a enum. Uses CreateEnum to construct the new enum object.

Parameters
reuseIf appropriate, uses this instead of creating a new enum object.
writerSchemaThe schema the writer used while writing the enum
readerSchemaThe schema the reader is using
dThe decoder for deserialization.
Returns
An enum object.

Reimplemented from Avro.Generic.DefaultReader.

◆ ReadFixed()

override object Avro.Reflect.ReflectDefaultReader.ReadFixed ( object  reuse,
FixedSchema  writerSchema,
Schema  readerSchema,
Decoder  d 
)
inlineprotectedvirtual

Deserializes a fixed object and returns the object. The default implementation uses CreateFixed() and GetFixedBuffer() and returns what CreateFixed() returned.

Parameters
reuseIf appropriate, uses this object instead of creating a new one.
writerSchemaThe FixedSchema the writer used during serialization.
readerSchemaThe schema that the reader uses. Must be a FixedSchema with the same size as the writerSchema.
dThe decoder for deserialization.
Returns
The deserialized object.

Reimplemented from Avro.Generic.DefaultReader.

◆ ReadMap()

override object Avro.Reflect.ReflectDefaultReader.ReadMap ( object  reuse,
MapSchema  writerSchema,
Schema  readerSchema,
Decoder  d 
)
inlineprotectedvirtual

Deserialized an avro map.

Parameters
reuseIf appropriate, use this instead of creating a new map object.
writerSchemaThe schema the writer used to write the map.
readerSchemaThe schema the reader is using.
dThe decoder for serialization.
Returns
The deserialized map object.

Reimplemented from Avro.Generic.DefaultReader.

◆ ReadRecord()

override object Avro.Reflect.ReflectDefaultReader.ReadRecord ( object  reuse,
RecordSchema  writerSchema,
Schema  readerSchema,
Decoder  dec 
)
inlineprotectedvirtual

Deserializes a record from the stream.

Parameters
reuseIf not null, a record object that could be reused for returning the result
writerSchemaThe writer's RecordSchema
readerSchemaThe reader's schema, must be RecordSchema too.
decThe decoder for deserialization
Returns
The record object just read

Reimplemented from Avro.Generic.DefaultReader.

Property Documentation

◆ ClassCache

ClassCache Avro.Reflect.ReflectDefaultReader.ClassCache
get

Class cache

◆ MapType

Type Avro.Reflect.ReflectDefaultReader.MapType
getset

C# type to create when deserializing a map. Must implement IDictionary<,> and the first type parameter must be a string. Default is System.Collections.Generic.Dictionary

◆ RecordFactory

Func<Type, object> Avro.Reflect.ReflectDefaultReader.RecordFactory
getset

Delegate to a factory method to create objects of type x. If you are deserializing to interfaces you could use an IoC container factory instead of the default. Default is Activator.CreateInstance()

Returns

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