Class UnionSchema
Class for union schemas
Inherited Members
Namespace: Avro
Assembly: Avro.dll
Syntax
public class UnionSchema : UnnamedSchema
Properties
| Improve this Doc View SourceCount
Count of schemas in the union
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Item[Int32]
Returns the schema at the given branch.
Declaration
public Schema this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Index to the branch, starting with 0. |
Property Value
Type | Description |
---|---|
Schema | The branch corresponding to the given index. |
Schemas
List of schemas in the union
Declaration
public IList<Schema> Schemas { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<Schema> |
Methods
| Improve this Doc View SourceCanRead(Schema)
Checks if this schema can read data written by the given schema. Used for decoding data.
Declaration
public override bool CanRead(Schema writerSchema)
Parameters
Type | Name | Description |
---|---|---|
Schema | writerSchema | writer schema |
Returns
Type | Description |
---|---|
System.Boolean | true if this and writer schema are compatible based on the AVRO specification, false otherwise |
Overrides
| Improve this Doc View SourceEquals(Object)
Compares two union schema objects
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | union schema object to compare against this schema |
Returns
Type | Description |
---|---|
System.Boolean | true if objects are equal, false otherwise |
Overrides
GetHashCode()
Hash code function
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
| Improve this Doc View SourceMatchingBranch(Schema)
Returns the index of a branch that can read the data written by the given schema s.
Declaration
public int MatchingBranch(Schema s)
Parameters
Type | Name | Description |
---|---|---|
Schema | s | The schema to match the branches against. |
Returns
Type | Description |
---|---|
System.Int32 | The index of the matching branch. If non matches a -1 is returned. |
WriteJson(JsonTextWriter, SchemaNames, String)
Writes union schema in JSON format
Declaration
protected override void WriteJson(JsonTextWriter writer, SchemaNames names, string encspace)
Parameters
Type | Name | Description |
---|---|---|
Newtonsoft.Json.JsonTextWriter | writer | JSON writer |
SchemaNames | names | list of named schemas already written |
System.String | encspace | enclosing namespace of the schema |