Avro C#

Public Member Functions | Static Public Member Functions | List of all members
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 More...
void | AddArrayHelper (string name, Type helperType)
| Add an array helper. Array helpers are used for collections that are not generic lists. More...
ArrayHelper | GetArrayHelper (ArraySchema schema, IEnumerable enumerable)
| Find an array helper for an array schema node. More...
DotnetClass | GetClass (RecordSchema schema)
| Find a class that matches the schema full name. More...
void | LoadClassCache (Type objType, Schema s)
| Add an entry to the class cache. More...

## Static Public Member Functions
static void | AddDefaultConverter (IAvroFieldConverter converter)
| Add a default field converter More...
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. More...

## 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

  name | Name of the helper. Corresponds to metadata "helper" field in the schema.
  helperType | Type of helper. Inherited from ArrayHelper

## ◆ AddDefaultConverter()

static void Avro.Reflect.ClassCache.AddDefaultConverter | ( | IAvroFieldConverter | converter | ) |
| inline static

Add a default field converter

Parameters

  converter |

## ◆ AddDefaultConverter< TAvro, TProperty >()

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

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

  schema | Schema
  enumerable | The 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

  objType | Type of the C# class
  s | Schema

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

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