Avro C#
Loading...
Searching...
No Matches
Avro.Reflect.ClassCache Class Reference

Class holds a cache of C# classes and their properties. The key for the cache is the schema full name. More...

Public Member Functions

IAvroFieldConverter GetDefaultConverter (Avro.Schema.Type tag, Type propType)
 Find a default converter.
void AddArrayHelper (string name, Type helperType)
 Add an array helper. Array helpers are used for collections that are not generic lists.
ArrayHelper GetArrayHelper (ArraySchema schema, IEnumerable enumerable)
 Find an array helper for an array schema node.
DotnetClass GetClass (RecordSchema schema)
 Find a class that matches the schema full name.
void LoadClassCache (Type objType, Schema s)
 Add an entry to the class cache.

Static Public Member Functions

static void AddDefaultConverter (IAvroFieldConverter converter)
 Add a default field converter.
static void AddDefaultConverter< TAvro, TProperty > (Func< TAvro, Schema, TProperty > from, Func< TProperty, Schema, TAvro > to)
 Add a converter defined using Func<>. The converter will be used whenever the source and target types match and a specific attribute is not defined.

Detailed Description

Class holds a cache of C# classes and their properties. The key for the cache is the schema full name.

Member Function Documentation

◆ AddArrayHelper()

void Avro.Reflect.ClassCache.AddArrayHelper ( string name,
Type helperType )
inline

Add an array helper. Array helpers are used for collections that are not generic lists.

Parameters
nameName of the helper. Corresponds to metadata "helper" field in the schema.
helperTypeType of helper. Inherited from ArrayHelper

◆ AddDefaultConverter()

void Avro.Reflect.ClassCache.AddDefaultConverter ( IAvroFieldConverter converter)
inlinestatic

Add a default field converter.

Parameters
converter

◆ AddDefaultConverter< TAvro, TProperty >()

void Avro.Reflect.ClassCache.AddDefaultConverter< TAvro, TProperty > ( Func< TAvro, Schema, TProperty > from,
Func< TProperty, Schema, TAvro > to )
inlinestatic

Add a converter defined using Func<>. The converter will be used whenever the source and target types match and a specific attribute is not defined.

Parameters
from
to
Template Parameters
TAvro
TProperty

◆ GetArrayHelper()

ArrayHelper Avro.Reflect.ClassCache.GetArrayHelper ( ArraySchema schema,
IEnumerable enumerable )
inline

Find an array helper for an array schema node.

Parameters
schemaSchema
enumerableThe array object. If it is null then Add(), Count() and Clear methods will throw exceptions.
Returns

◆ GetClass()

DotnetClass Avro.Reflect.ClassCache.GetClass ( RecordSchema schema)
inline

Find a class that matches the schema full name.

Parameters
schema
Returns

◆ GetDefaultConverter()

IAvroFieldConverter Avro.Reflect.ClassCache.GetDefaultConverter ( Avro.Schema.Type tag,
Type propType )
inline

Find a default converter.

Parameters
tag
propType
Returns
The first matching converter - null if there isn't one

◆ LoadClassCache()

void Avro.Reflect.ClassCache.LoadClassCache ( Type objType,
Schema s )
inline

Add an entry to the class cache.

Parameters
objTypeType of the C# class
sSchema

The documentation for this class was generated from the following file:
  • src/apache/main/Reflect/ClassCache.cs