Class Schema
Base class for all schema types
Inherited Members
Namespace: Avro
Assembly: Avro.dll
Syntax
public abstract class Schema
Constructors
| Improve this Doc View SourceSchema(Schema.Type, PropertyMap)
Constructor for schema class
Declaration
protected Schema(Schema.Type type, PropertyMap props)
Parameters
| Type | Name | Description |
|---|---|---|
| Schema.Type | type | |
| PropertyMap | props |
Properties
| Improve this Doc View SourceName
The name of this schema. If this is a named schema such as an enum, it returns the fully qualified name for the schema. For other schemas, it returns the type of the schema.
Declaration
public abstract string Name { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Tag
Schema type property
Declaration
public Schema.Type Tag { get; }
Property Value
| Type | Description |
|---|---|
| Schema.Type |
Methods
| Improve this Doc View SourceareEqual(Object, Object)
Compares two objects, null is equal to null
Declaration
protected static bool areEqual(object o1, object o2)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | o1 | first object |
| System.Object | o2 | second object |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if two objects are equal, false otherwise |
CanRead(Schema)
Returns true if and only if data written using writerSchema can be read using the current schema according to the Avro resolution rules.
Declaration
public virtual bool CanRead(Schema writerSchema)
Parameters
| Type | Name | Description |
|---|---|---|
| Schema | writerSchema | The writer's schema to match against. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if and only if the current schema matches the writer's. |
GetHashCode()
Hash code function
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 |
Overrides
getHashCode(Object)
Hash code helper function
Declaration
protected static int getHashCode(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj |
Returns
| Type | Description |
|---|---|
| System.Int32 |
GetProperty(String)
Returns the schema's custom property value given the property name
Declaration
public string GetProperty(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | custom property name |
Returns
| Type | Description |
|---|---|
| System.String | custom property value |
GetTypeString(Schema.Type)
Returns symbol name for the given schema type
Declaration
public static string GetTypeString(Schema.Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| Schema.Type | type | schema type |
Returns
| Type | Description |
|---|---|
| System.String | symbol name |
Parse(String)
Parses a given JSON string to create a new schema object
Declaration
public static Schema Parse(string json)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | json | JSON string |
Returns
| Type | Description |
|---|---|
| Schema | new Schema object |
ToString()
Returns the canonical JSON representation of this schema.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | The canonical JSON representation of this schema. |
Overrides
WriteJson(JsonTextWriter, SchemaNames, String)
Writes schema object in JSON format
Declaration
protected virtual 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 |
WriteJsonFields(JsonTextWriter, SchemaNames, String)
Default implementation for writing schema properties in JSON format
Declaration
protected virtual void WriteJsonFields(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 |